How to interpret CURLE_WEIRD_SERVER_REPLY?
SherwoodP via curl-library <[email protected]> Sat, 18 Oct 2025 11:11:18 -0700
| Newsgroups | gmane.comp.web.curl.library |
|---|---|
| Message-ID | <[email protected]> |
BACKGROUND:
I am trying to use curl v8.6.0 on a Windows 11 system to send email to my
POP3 server (att.com). AT&T uses "secure mail keys" for
authentication.
I can access AT&T's email web interface using a user name and
password.
I can also access the same account with Eudora, which requires a secure
mail key.
USING CURL:
This is the curl C++20 code I am using to send a sample message:
curl = curl_easy_init();
if
(curl)
{
CURLcode
code=curl_easy_setopt(curl,
CURLOPT_URL,
si
.server);
code=curl_easy_setopt(curl,
CURLOPT_USE_SSL,
(long
)
CURLUSESSL_ALL
);
code = curl_easy_setopt(curl,
CURLOPT_SSL_VERIFYPEER, 0L);
// Tell libcurl
to *not* verify the peer
code = curl_easy_setopt(curl,
CURLOPT_USERNAME,
si
.userName);
code = curl_easy_setopt(curl,
CURLOPT_PASSWORD,
si
.pw);
code = curl_easy_setopt(curl,
CURLOPT_MAIL_FROM,
si
.from);
recipients = curl_slist_append(recipients,
si
.to);
if
(strlen(
si
.cc))
// cc: is
optional
recipients =
curl_slist_append(recipients,
si
.cc);
code = curl_easy_setopt(curl,
CURLOPT_MAIL_RCPT,
recipients);
code = curl_easy_setopt(curl,
CURLOPT_READFUNCTION,
payload_source);
code = curl_easy_setopt(curl,
CURLOPT_READDATA,
&upload_ctx);
code = curl_easy_setopt(curl,
CURLOPT_VERBOSE, 1L);
/* send the
message (including headers) */
res =
curl_easy_perform(curl);
}
Structure si at the beginning of the code above contains
si{
server = "smtp://outbound.att.net:587"
userName = "MyUserName"
pw = "MySecureKey"
t = "ToEmailAddr"
from = "FromEmailAddr"
cc = "<[email protected]>"
messageID = "Communicate_000000006334"
subject = "Communicate test email"
nBodyLines = 10
body
[0] = "\tThe Germ"
[1] = ""
[2] = "A mighty creature is the germ,"
[3] = "Though smaller than a pachyderm."
[4] = "His customary dwelling place"
[5] = "Is deep within the human race."
[6] = "His childish pride he often pleases"
[7] = "By giving people strange diseases."
[8] = "Do you, my poppet, feel infirm?"
[9] = "You probably contain a germ."
};
Running this code gives res = CURLE_WEIRD_SERVER_REPLY (8)
"curl_easy_perform() failed: Weird server reply" if I use the
AT&T secure key as si.pw, and "Login denied" if I use the
AT&T password.
To debug my usage of curl, I'd like to know what the "weird
reply" is, or any other logging that curl provides. If the curl code
is wrong in any way, or missing some detail of authentication, I'd
appreciate advice on how to fix it.
For comparison, the email client Eudora can successfully send email to
this account. An excerpt from Eudora's debugging log is below. This shows
that Eudora has successfully logged in.
MAIN 16:14.54 Preparing messages to Send: 1
MAIN 16:14.54 RSET
MAIN 16:14.54 MAIL FROM:<FromEmailAddr>
MAIN 16:14.54 RCPT TO:<ToEmailAddr>
MAIN 16:14.54 DATA
MAIN 16:14.54 Test message
MAIN 16:14.54 Preparing messages to Send: 0
21296 16:14.54 Open 67.195.12.35:465
21296 32:14.54 Sent: " 16 03 01 00 F4 01 00 00 F0
03 03 C5 93 55 57 E6"
...
21296 64:14.54 Rcvd: " 16 03 03 13 2E 02
00"
...
21296 64:14.54 Rcvd: "220 smtp.mail.yahoo.com
ESMTP ready\r\n"
21296 32:14.54 Sent: "EHLO
MyComputerName.MyEmailDomain\r\n"
21296 64:14.54 Rcvd:
"250-hermes--production-gq1-6b8576c5cf-gs5mr Hello
MyComputerName.MyEmailDomain [xx.xx.xx.xx])\r\n"
21296 64:14.54 Rcvd:
"250-PIPELINING\r\n"
21296 64:14.54 Rcvd:
"250-ENHANCEDSTATUSCODES\r\n"
21296 64:14.54 Rcvd: "250-8BITMIME\r\n"
21296 64:14.54 Rcvd: "250-SIZE
41697280\r\n"
21296 64:14.54 Rcvd: "250 AUTH PLAIN LOGIN XOAUTH2
OAUTHBEARER\r\n"
21296 32:14.54 Sent: "AUTH LOGIN\r\n"
21296 64:14.54 Rcvd: "334
xxxxxxxxxxxx\r\n"
21296 32:14.54 Sent:
"xxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n"
21296 64:14.54 Rcvd: "334
xxxxxxxxxxxx\r\n"
21296 32:14.54 Sent:
"xxxxxxxxxxxxxxxxxxxxxxxx\r\n"
21296 64:14.56 Rcvd: "235 2.7.0 Authentication
successful\r\n"
21296 32:14.56 Sent: "RSET\r\n"
21296 64:14.56 Rcvd: "250 2.0.0 OK\r\n"
21296 32:14.56 Sent: "MAIL
FROM:<FromEmailAddr>\r\n"
21296 64:14.56 Rcvd: "250 2.1.0 Sender
<FromEmailAddr> OK\r\n"
21296 32:14.56 Sent: "RCPT
TO:<ToEmailAddr>\r\n"
21296 64:14.56 Rcvd: "250 2.1.5 Recipient
<ToEmailAddr> OK\r\n"
21296 32:14.56 Sent: "DATA\r\n"
21296 64:14.56 Rcvd: "354 Ok Send data ending with
<CRLF>.<CRLF>\r\n"
21296 32:14.56 Sent: "X-Mailer: QUALCOMM Windows
Eudora Version 7.1.0.9\r\n"
21296 32:14.56 Sent: "Date: Sat, 18 Oct 2025
10:53:07 -0700\r\n"
21296 32:14.56 Sent: "To:
ToEmailAddr\r\n"
21296 32:14.56 Sent: "From:
FromEmailAddr\r\n"
21296 32:14.56 Sent: "Subject: Test
message\r\n"
21296 32:14.56 Sent: "Mime-Version:
1.0\r\n"
21296 32:14.56 Sent: "Content-Type: text/plain;
charset="us-ascii"; format=flowed\r\n"
21296 32:14.56 Sent: "\r\n"
21296 32:14.56 Sent: "Body of
message.\r\n"
21296 32:14.56 Sent: "\r\n"
21296 32:14.56 Sent: ".\r\n"
21296 64:14.57 Rcvd: "250 OK ,
completed\r\n"
21296 32:14.57 Sent: "QUIT\r\n"
21296 64:14.57 Rcvd: "221 Service Closing
transmission\r\n"
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html