Changelog
Daniel Stenberg (20 Feb 2010)
+- Fixed the SMTP compliance by making sure RCPT TO addresses are specified
+ properly in angle brackets. Recipients provided with CURLOPT_MAIL_RCPT now
+ get angle bracket wrapping automatically by libcurl unless the recipient
+ starts with an angle bracket as then the app is assumed to deal with that
+ properly on its own.
+
- I made the SMTP code expect a 250 response back from the server after the
full DATA has been sent, and I modified the test SMTP server to also send
that response. As usual, the DONE operation that is made after a completed
curl_slist\fP structs properly filled in. Use \fIcurl_slist_append(3)\fP to
create the list and \fIcurl_slist_free_all(3)\fP to clean up an entire list.
+Each recipient in SMTP lingo is specified with angle brackets (<>), but should
+you not use an angle bracket as first letter libcurl will assume you provide a
+single email address only and enclose that with angle brackets for you.
+
(Added in 7.20.0)
.SH TFTP OPTIONS
.IP CURLOPT_TFTP_BLKSIZE
return result;
}
+static CURLcode smtp_rcpt_to(struct connectdata *conn)
+{
+ CURLcode result = CURLE_OK;
+ struct smtp_conn *smtpc = &conn->proto.smtpc;
+
+ /* send RCPT TO */
+ if(smtpc->rcpt) {
+ if(smtpc->rcpt->data[0] == '<')
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s",
+ smtpc->rcpt->data);
+ else
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s>",
+ smtpc->rcpt->data);
+ if(!result)
+ state(conn, SMTP_RCPT);
+ }
+ return result;
+}
+
/* for MAIL responses */
static CURLcode smtp_state_mail_resp(struct connectdata *conn,
int smtpcode,
}
else {
struct smtp_conn *smtpc = &conn->proto.smtpc;
-
- /* send RCPT TO */
smtpc->rcpt = data->set.mail_rcpt;
- if(smtpc->rcpt) {
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s",
- smtpc->rcpt->data);
- if(result)
- return result;
- }
-
- state(conn, SMTP_RCPT);
+ result = smtp_rcpt_to(conn);
}
+
return result;
}
else {
struct smtp_conn *smtpc = &conn->proto.smtpc;
- /* one RCPT is done, but if there's one more to send go on */
- smtpc->rcpt = smtpc->rcpt->next;
if(smtpc->rcpt) {
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s",
- smtpc->rcpt->data);
- if(result)
- return result;
+ smtpc->rcpt = smtpc->rcpt->next;
+ result = smtp_rcpt_to(conn);
- state(conn, SMTP_RCPT);
- return CURLE_OK;
+ /* if we failed or still is in RCPT sending, return */
+ if(result || smtpc->rcpt)
+ return result;
}
/* send DATA */
smtpstate instate)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
- struct FTP *smtp = data->state.proto.smtp;
(void)instate; /* no use for this yet */
return; # failure
}
- if($testno eq "verifiedserver") {
+ if($testno eq "<verifiedserver>") {
sendcontrol "554 WE ROOLZ: $$\r\n";
return 0; # don't wait for data now
}
else {
- $testno =~ s/^([0-9]*).*/$1/;
+ $testno =~ s/^([^0-9]*)([0-9]+).*/$2/;
sendcontrol "354 Show me the mail\r\n";
}