Simplenews_realname will cause emails sent by the mandrill module to fail. The reason is the simplenews_realname_mail_alter function on line 31 of simplenews_realname.module modifies the value of $messages['to'] address from a simple email to the following format:
"Name" <example@example.com>
This formatted email address is passed back, and ends up in the $mandrill_message array created on line 96 of mandrill.mail.inc (a file belonging to the mandrill module). For a single recipient, this ends up looking like this if the simplenews_realname module is enabled:
$mandrill_message['to'][0]['email'][formatted email output by simplnews_realname_mail_alter]
Because mandrill expects a plain email address here, it rejects the message with a code of "invalid".
I solved the problem by modifying line 39 of simplenews_realname.module to include a check for the mandrill module, and if it is enabled, to not reformat the To email address. The modified line I used is here:
if ((drupal_substr(PHP_OS, 0, 3) !== 'WIN') && !module_exists('mandrill')) {
If it were important to you to format the email address when using mandrill, it should probably be done implementing hook_mandrill_mail_alter (see drupal_alter implementation on line 118 of mandrill.mail.inc) within simplenews_realname.module (in combination with the code modification shown above). The basic idea would be to add the following value to the $mandrill_message array:
$mandrill_message['to'][0]['email']= RAW EMAIL HERE; // This line isn't necessary, the value is already there
$mandrill_message['to'][0]['name']= REALNAME HERE;You can see the structure mandrill is expecting here: https://mandrillapp.com/api/docs/messages.html
Comments
Comment #1
sja1 commentedComment #3
sgabe commentedThe suggested modification has been committed to the development branch.