I'm using simplenews and mimemail modules to send out a newsletter.
The Return-Path is being set as the apache user instead of the correct 'from' address.

I've got Returnpath module installed which works for the regular drupal emails (registration/password reminders etc), but unfortunately it doesn't work when sending through mimemail.

In the mimemail.module there is a comment:

  // Note: This may work or not. The MTA might rewrite the Return-Path, and Errors-To is deprecated.
  // Depending on your MTA and its configuration you can make it work by specifying appropriate arguments in $additional_parameters

Can anybody suggest a solution to this?

Comments

budda’s picture

mimemail_mailengine() needs altering to add support for the optional 5th argument to the mail() function.

        $status = mail(
          $a,
          $message['subject'],
          $message['body'],
          mimemail_rfc_headers($message['headers']),
   	    '-finfo@example.com'
        ) && $status;

info@example.com is the from address that sendmail will use.

--
Ixis (UK) providing Drupal consultancy and Drupal theme design.

markhope’s picture

Thanks Budda,

Could you advise how this be applied to the 4.7 version?

Mark

fjen’s picture

i'm not a fan of altering existing module's code (makes upgrading a pain). so my solution to this was to implement my own mailengine in a "fix-module" which is super-easy: just copy the mimemail_mailengine() function to you modules file, rename it to your module-name and alter the code as supposed above .. btw it's "-f user@domain.ext" ( with a space after the -f ).

F

miccil’s picture

I packaged mimemail engine module that resolve this issue.
You can find it here http://drupal.org/node/1002382#comment-3844818
Tested with postfix on CentOS

Robert Molenaar’s picture

I found the solution for Drupal 6 with mimemail by adding the following code:

ini_set("sendmail_from","mail@domain.com");

I placed it in the mimemail.module just above the mail() function... I know for sure it can be done beter, but then again it works...

I had this problem with simplenews and mimemail. No need (for my situation) for the -f parameter.

Robert

PS: On the downside... before the patch my testmail wasn't blocked as spam by hotmail, but now it is... maybe of all the testmails...??)