cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Sending an e-mail

From: Brad Hards <bradh_at_frogmouth.net>
Date: Wed, 22 Dec 2010 12:32:11 +1100

On Wednesday, December 22, 2010 08:56:58 am Patrick Monnerat wrote:
> > This is the code I use:
> > #define FROM "mymail_at_gmail.com"
> > #define TO "mymail_at_gmail.com"
>
> Your authentication has been accepted by the gmail server (235 2.7.0
> accepted), but the "MAIL FROM command has a syntax error: you have to
> enclose e-mail addresses in <>.
It looks like libcurl handles it correctly in the RCPT TO case, but not in the
MAIL FROM case. Interesting that it worked ok in my (limited) tests.

Daniel: do you think smtp_mail() should have similar logic to smtp_rcpt_to(),
like this (untested code - do not apply):
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -755,8 +755,14 @@ static CURLcode smtp_mail(struct connectdata *conn)
   struct SessionHandle *data = conn->data;
 
   /* send MAIL */
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "MAIL FROM:%s",
- data->set.str[STRING_MAIL_FROM]);
+ if (data->set.str[STRING_MAIL_FROM][0] == '<') {
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "MAIL FROM:%s",
+ data->set.str[STRING_MAIL_FROM]);
+ }
+ else {
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "MAIL FROM:<%s>",
+ data->set.str[STRING_MAIL_FROM]);
+ }
   if(result)
     return result;
 
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-22