Changing the sender of email I am using the Printer, email and PDF versions module, together with the PHPMailer module to send emails. It works perfectly, but only from the email in admin/config/system/site-information. How could I use hook_mail_alter() or similar hook in order to send from different accounts of the site depending on the situation?

Do I need to install another module, or can it be achieved by using a hook? hook_mail_alter() just have "from" but that is a dummy email address which can be even simulated.
After many unsuccesful tests, I have finally found the solution through
Set the &quot;from&quot; header in the email to be in the format &quot;Full Name&quot; &lt;email@address.com&gt;.

In your module, you must use the following code, which can be customized via the ID of the email or other parameters which are contained in the variable $message (which is passed by reference, so can be modified by the hook):

function my_module_mail_alter(&amp;$message){

    $from = "user-account@domain.name" ;

    $message['from'] = $from;
    $message['headers']['From'] = $from;
    $message['headers']['Sender'] = $from;
    $message['headers']['Return-Path'] = $from;

} // function