cURL / Mailing Lists / curl-library / Single Mail


[PATCH] smtp_mail: Added support to MAIL FROM for the optional AUTH parameter

From: Steve Holme <>
Date: Wed, 5 Oct 2011 22:50:29 +0100

Dear all,

Please find attached a patch that adds support for the optional AUTH
parameter to the SMTP MAIL FROM command.

In order to support this functionality I have had to add a new
CURLOPT_MAIL_AUTH option in curl.h as well as the associated string in
urldata.h and url.c.

I have modified the smtp_mail() function in smtp.c to include the parameter
in the MAIL FROM: command if an authentication method is being used (as the
parameter should not be included when no authentication mechanism is used).

This option should not be set by client applications who only connect to a
mail server to send email, but instead, is intended for servers who relay
mail messages to other servers in
a trusted environment. According to RFC 2554 and more specifically RFC 4954
"If the server trusts the authenticated identity of the client to assert
that the message was originally submitted by the supplied <mailbox>, then
the server SHOULD supply the same <mailbox> in an AUTH parameter when
relaying the message to any other server which supports the AUTH

This functionality was originally included in my work from July and August
but I decided to keep it out of some of my more recent changes until the
NTLM support was added (as the authused variable was needed). Bare disabling
the initial response in the AUTH parameter this completes my work from July
/ August.

Daniel: Do you want me to update the curl_easy_setopt.3 man page?

Any comments are, as always, welcome.



Received on 2011-10-05