The default behave of Drupal is to set site-mail as "from address" if none is passed as parameter in drupal_mail. A mail server might be configured to not allow a authentication user to use another "from address". In this case, an email will be sent only if another module change the "from address", e.g. webform.
Since phpmailer enable to set an SMTP authentication user, it also should allow to set the default "from address" as the authentication user, or maybe any other than site-mail.
A workaround solution is set site-mail as the authentication user, but site-mail is an info related to the site itself not SMTP authentication. As site-mail should receive emails, a dumb "no-reply" SMTP user could not be used here.
Comment | File | Size | Author |
---|---|---|---|
#3 | from_address-1689846-3.patch | 1.32 KB | moskito |
#1 | from_address-1689846-1.patch | 1.32 KB | moskito |
Comments
Comment #1
moskito CreditAttribution: moskito commentedAfter further investigation, I found out that to reproduce this issue a postfix server must has
smtpd_sender_restrictions
withreject_sender_login_mismatch
[1].That configuration actually does the mail server to check if
$message['headers']['Sender']
address is owned bysmtp_username
.In
drupal_mail
is statedDrupal core suppose that
site_mail
address has a domain authorized. But, once phpmailer enable one to set an another SMTP server and SMTP username, the address must also be owned by SMTP username (if SMTP server configured in that way).In this patch, there is another text area in the advanced section in configuration form called "From address". This information if filled will replace
$message['headers']['Sender']
and$message['from']
.Note that making header-Sender and body-from the same avoid identity forgery. And some SMTP servers do it automatically using filters before sending the message.
[1] http://www.postfix.org/postconf.5.html#smtpd_sender_restrictions
Comment #2
moskito CreditAttribution: moskito commentedComment #3
moskito CreditAttribution: moskito commentedResending patch to testbot it after #1719434: PHPMailer doesn't pass in testbot.
Comment #4
ayalon CreditAttribution: ayalon commentedTested and Working.
Please commit this long standing issue...
Comment #5
moskito CreditAttribution: moskito commentedI've been using it in production since my last post without problem, and ayalon has tested it. I guess it is pretty safe to set it as reviewed.
Comment #6
sunI'm not sure whether I agree with this change.
Why wouldn't you set the site e-mail to the From address that you're using for e-mail communication? (Even more so, if your SMTP server requires you to use that e-mail?)
Comment #7
moskito CreditAttribution: moskito commentedBesides it will be semantic wrong, the 'contact' core module create a site contact form which uses site mail as recipient. Probably, there are other modules that use site mail as it semantically suggests.
Comment #8
RavinderChopra CreditAttribution: RavinderChopra as a volunteer and commentedSteps to Resolve this issue.
1. Go to Modules page
2. Go to Webform under module page and click on configure link.
3. Go down and change the email address listed here. This is your default email address for your webform.
4. Save the form and your email address has been updated.
Enjoy