cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SMTP Invalid Address (501 5.5.4)

From: Tom Sparrow <tom.sparrow25_at_gmail.com>
Date: Tue, 20 May 2014 18:51:52 +0900

I am extremely sorry for delay in responding. Thanks for your replies.

A dummy valid hostname could be a string that follows hostname
specification as per RFC 952 and RFC 1123.

Please check the patch that possibly solves "501 5.5.4 Invalid
Address" issue when machine's hostname is set to some invalid value.
Hope it also explains the problem I encountered.

--- /home/curl_org/curl/lib/smtp.c
+++ /home/curl_new/curl/lib/smtp.c
@@ -721,6 +721,11 @@
   (void)instate; /* no use for this yet */

   if(smtpcode/100 != 2 && smtpcode != 1) {
+ if(smtpcode == 501) {
+ memcpy(smtpc->domain,"DUMMY_HOST",strlen("DUMMY_HOST")+1);
+ result = smtp_perform_ehlo(conn);
+ }
+ else
     if(data->set.use_ssl <= CURLUSESSL_TRY || conn->ssl[FIRSTSOCKET].use)
       result = smtp_perform_helo(conn);
     else {
@@ -822,8 +827,14 @@
   (void)instate; /* no use for this yet */

   if(smtpcode/100 != 2) {
- failf(data, "Remote access denied: %d", smtpcode);
- result = CURLE_REMOTE_ACCESS_DENIED;
+ if(smtpcode == 501) {
+ memcpy(conn->proto.smtpc.domain,"DUMMY_HOST",strlen("DUMMY_HOST")+1);
+ result = smtp_perform_ehlo(conn);
+ }
+ else {
+ failf(data, "Remote access denied: %d", smtpcode);
+ result = CURLE_REMOTE_ACCESS_DENIED;
+ }
   }
   else
     /* End of connect phase */

Alternatively

Curl_gethostname() can be modified to check "name" returned by
gethostname(name, namelen) for its validity and in case it is invalid,
DUMMY hostname can be assigned to "name".

Not all SMTP servers emit this issue.

Thanks and Regards
Tom
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-05-20