I have nearly gone insane trying to figure out how to setup of email for my site.
I have 2 text format types I wish to apply to all outgoing mail on our website
1) Plain Text (Convert newlines to
tags and convert urls to links)
2) Full HTML (everything else)
I have had to install the following modules to get as close possible
Mimemail (Enabling HTML Mail)
Mandrill (Send Mail via api)
SMTP Authentication (Send mail thru Mandrill via SMTP)
Mailsystem (routing mail through appropriate classes)
For my use case the majority of mail coming from site needs PLAIN TEXT filter applied to just preserve newlines and convert urls to links so mandrill can track click rates. The remaining mail needs full HTML. In order to accomplish this I did the following
1. Configure mandrill to apply PLAIN TEXT format to all outgoing mail
2. Set system default mail system delivery and format to Mandrill
3. Create mail class for Mime Mail with delivery set to SMTP (to avoid PLAIN TEXT formatting imposed by sending through mailchimp module) and formatting set to MIME MAIL which applies FULL HTML formatting.
I've spent the last few days trying to figure out why things weren't working when I just webform uses mandrill by default for all html emails when it is detected on the system. Seeing as I have SMTP and Mandrill installed its using mandrill by default instead of mime mail which doesn't seem right. There should be a choice on the general webform configuration page listing which modules are installed to handle html mail so user can select instead of imposing one of another.
Comments
Comment #1
danchadwick commentedThe Mail System module determines which modules are used to compose and send e-mail message for each sending module. This is how Webform's messages are sent. Your problem probably lies in how Mail System is configured.
Comment #2
kcannick commentedHey thanks for the response. I ended solving this with what seems to be an overly elaborate setup on my part, but I also discovered what appears to be a bug in webform. I created a email template for that specific webform which is used when form is submitted but ignored when using the resend email link when resending individual submissions
Comment #3
danchadwick commentedRe #2 -- please open a new issue so that we can reproduce and fix it. Thanks.
Comment #5
kcannick commentedI was attempting to route all mail through mandrill module using API so that I could also see open/click stats.
Issue 1: Mandrill was formatting $message in its mail() method... so no matter what I configured for formatting of mail class in mail system it was ultimately double formatted because MANDRILL was selected as the send method.
Issue 2: Mime Mail module passes multipart encoded $message to mandrill which expects only HTML to be sent via api and encoded by mandrill this lead to messages being double encoded anytime MIME MAIL was used for formatting and sending was assigned to MANDRILL
Issue 3: Having resolve issue 1 in a newer release of MANDRILL which moves formatting to the actual formatting method(), problem two still remains as webform ONLY works with Mimemail/SMTP setup even though I have mandrill installed which effectively renders the need for those modules redundant and prevents me from getting the analytics about system emails as messages are now sent via SMTP instead of api.
SOLUTION: My issue would be solved if Webform supported other HTML email mail classes when available. I've seen a few issues regarding this but confused because it seems this is the case but I am receiving the following error when trying to submit webform with attachment.
ERROR: Exception: audio/mpeg is not a valid content type. in MandrillMailSystem->getAttachmentStruct() (line 228 of /code/sites/all/modules/mandrill/lib/mandrill.mail.inc).
Comment #6
kcannick commentedFigured out part of my issue with Mailchimp module wasn't coded to accept audio/mpeg as a valid mimetype... After fixing issue I just wrote my own mail class that dynamically formats message body on a per message basis. I only have two FULL HTML and PLAIN TEXT (which gets converted to HTML link URLs, preserves NEW LINES, etc). If anyone else is having this issue hopefully this helps.