Simplenews is one of the solid Newsletter management modules for Drupal. It allows a Drupal site to have multiple newsletters at once, nodes can be sent out as newsletter to multiple recipients on a single cron run. It plays well with HTML emails as well with Editors like WYSIWYG, Drupal mail system and other contrib modules like Mime Mail. Besides these, it allows to have specific sender name and email address per newsletter.
But the sign up and opt out confirmation email doesn't obey the sender information settings, perhaps this is by design of the module but not quite right with respect to our requirements. This blog tries to provide a simple fix for the same using Drupal's standard mail system hook.
Though we configure each newsletter in "admin/config/services/simplenews/categories/%/edit" to have specific sender name and email address, it always takes the sender name and email address from "admin/config/services/simplenews/settings" which is the global details for all the newsletters.
So to avoid this, we need to use hook_mail_alter(). The following simple code snippet will give the solution to this problem,
Please submit this as a patch, sounds like a useful thing to do by default. It will obviously not work for the multi-subscribe feature, but that's OK.