Problem/Motivation
This was partly resolved in #209672: Use site name in From: header for system e-mails, but apparently it was not enough for all email clients.
Original issue summary:
The aim of this issue is to give e-mails from the site administrator a "from" title set to the website name and not just an e-mail address.
In Drupal 5 this was possible by configuring "Site Webmaster" <webmaster@site.com> in Site information, but since 6.x the additional validation prevents such an e-mail address configuration.
You are now limited to just the e-mail address, without a name. Hence site e-mails appear to be from just webmaster@site.com, which is just not as nice :)
Proposed resolution
Specify in the "From:" header the site name along with the site email address.
Remaining tasks
- The patch should not give Notices/Errors on sites which do not have site name defined
- Get RTBC.
User interface changes
In your email, you'll see the Site name instead of the email address.
Screen capture attached of my email client:

API changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3098024-mail-from-2.patch | 3.88 KB | sokru |
Comments
Comment #2
sokru commentedRerolled patch from #209672-146: Use site name in From: header for system e-mails, credits to @Andrew Answer and @jcisio
Comment #3
alexpottAs per my comment on the other issue. I'm not convinced this is a fix. We need to understand more about the problems @Andrew Answer is experiencing - because with the default Drupal 8 core mailer the from address on the email will come from the headers.
This issue summary is incorrect. It's definitely not about the email client - it is probably about an email module on the Drupal side - and we need to work out which one as I think the bug is there and not in core.
Comment #4
alexpottCopying the previous issue summary is incorrect. What we need are steps to reproduce so we can isolate why @Andrew Answer is experiencing the problem.
Comment #5
jcisio commentedChecking out a site that we experienced problem, there is mailsystem + swiftmailer. Do you happen to have the same, sokru?
Comment #6
alexpottSo @Berdir pointed out that #2641772: From header is dropped, incompatiblity with Simplenews exists and has been fixed in the Switfmailer module. Are we sure that we're nmot dealing with old Swiftmailer code here?
Comment #7
sokru commentedWe're running also mailsystem + swiftmailer. Swiftmailer is on dev
694cbf2and so it includes #2641772: From header is dropped, incompatiblity with Simplenews.Comment #8
avpadernoComment #9
alexpott@sokru well we need to understand why it's not using the header from. ANy chance you can debug that?
Comment #10
sokru commentedTurned out to be Mailgun contrib module sender that messes up the From header. We've Swiftmailer as a formatter and Mailgun as a sender. Changing the sender fixes the issue. In Mailgun's testmail
hook_mailthere's proof that something wrong in their end:$message['from'] = sprintf('%s <%s>', $site_name, $message['from']);So I'm closing this as a non-core issue.
Edit: Created an issue to Mailgun #3098127: Use site name in From: header, but other mail senders might have this issue too.
Comment #11
jcisio commentedWe use the beta2 version of swiftmailer. I can also confirm it is not a Drupal core bug. Thanks @alexpott and @berdir for the information.