4

I'm using the mailsystem module to send webform notification emails using mandrill.

However, for some of our webforms we need to use mandrill for the notification email sent to the users, but send the admin notifications without mandrill, using normal text based emails.

From what I can tell you can only change the mailsystem on a per module or per-key basis, and it seems like all webform emails use the same key -- "submission".

Is there any way to achieve what I want here?

Thanks,

2
  • 1
    I was wondering just the same, I think that in this use case is needed use a hook for alter the mail module webform uses, the problem is exact what you say, all the emails are sent with the same key, so it makes difficult to know what is what.
    – svelandiag
    Oct 15, 2014 at 16:08
  • I'd look into writing your own mailsystem implementation. The idea would be that it can then act as a switch, selecting the final sending class based on email content as well as the key. Oct 22, 2014 at 8:58

2 Answers 2

3
+50

I think you can do this via hook_mail_alter you'll need to write your own implementation but should be possible.

From what I can see in webform.submissions.inc inside webform_submission_send_mail()

// Build the e-mail headers.
    $email['headers'] = theme(array('webform_mail_headers_' . $node->nid, 'webform_mail_headers'), array('node' => $node, 'submission' => $submission, 'email' => $email));

It should be possible to use hook_mail_alter to choose the right submission and also the e-mail address it's being sent to.

0

It sounds like its not possible. If I'm right mandrill is a SMTP-like server and it works with the drupal_mail function, right?

If so than it's not possible because you only can set a SMTP address once in your apache settings.

Possible solutions are make a callback to an other folder where the apache settings are different. But if it doesn't use the drupal_mail function than you perhaps are able to do this in a if statement. Something like this...

if ($admin) {
    drupal_mail();
} else {
    mandrill_mail();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.