We are using mandrill & simplenews for one of our projects.

Mandrill module seems to implement MailSystemInterface. Method mail() in the same looks as in this link https://gist.github.com/anonymous/7663308/revisions

See line no. 35, for to address it obeys what is already set in $message which is expected,

 // Extract an array of recipients.
 $to = mandrill_get_to($message['to']); 

but for $from this is not the case, see line no. 71

    $from = mandrill_from();
    $mandrill_message = array(
      'html' => $message['body'],
      'text' => $plain_text,
      'subject' => $message['subject'],
      'from_email' => $from['email'],
      'from_name' => $from['name'],
      ....

This makes mandrill to disobey the per list "From name" and "From address" set in simplenews configuration. Instead site information name and email address values are used.

At least hook_mandrill_mail_alter() shall recuse, but it receives simplenews node object with protected access specifier which makes impossible to read the needful (but this is nothing to do with mandrill though). We had to patch the module to get the needed result.

Wondering to see if there is any obvious reason for doing this. If not, this can be taken as bug report and needful fix shall be applied.

Btw, thanks for the solid module otherwise!

Comments

gcb’s picture

Status: Active » Closed (won't fix)

This has been much-discussed and was, for a time, working as you describe.

However, allowing arbitrary assignment of the "from" field is volatile, and Mandrill will refuse any address that isn't at the properly formulated domain from sending at all. The official, proper way to do this is to use "reply-to" as a configurable address rather than the from.

As you note, we let you work around this with an _alter() if you must, but the behavior is deliberate and appropriate.

jphelan’s picture

Could not a solution be to add a qualified domain name setting where the user can enter an approved Mandrill domain and then compare the from address to see if it matches the domain? If it doesn't then set it to the fallback site email?