Commit 375aa41b authored by Brad Hards's avatar Brad Hards Committed by Daniel Stenberg
Browse files

SMTP: add brackets for MAIL FROM

Similar to what is done already for RCPT TO, the code now checks for and
adds angle brackets (<>) around the email address that is provided for
CURLOPT_MAIL_RCPT unless the app has done so itself.
parent 5f829456
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -754,9 +754,13 @@ static CURLcode smtp_mail(struct connectdata *conn)
  CURLcode result = CURLE_OK;
  struct SessionHandle *data = conn->data;

  /* send MAIL */
  /* send 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;