Hello
I have installed elastic_email, mailsystem and mimemail modules. At mailsystem admin page I configure NEW CLASS - I choose "format() method" by MimeMailSystem and "mail() method" by ElasticEmailMailSystem. By "Site-wide default MailSystemInterface class" I choose my new class - "MimeMailSystem_ElasticEmailMailSystem".
In RULES action I add Send e-mail (or Send HTML e-mail), fill all fields (with HTML message) and fire this rules.
After rules fired I get HTML email with additional text: "This is a multi-part message in MIME format. --5c7bb7ad08392cba9f7aae56de9051dfc350c32b1 Content-Type: multipart/alternative; boundary="c5c4527fb38b58306095527da6e6c93029064ba70" Content-Transfer-Encoding: 8bit --c5c4527fb38b58306095527da6e6c93029064ba70 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit......".
I tried all another combination in mailsystem admin page, but nothing happens.
How can I send the correct html email?
Thanks.
Comment | File | Size | Author |
---|---|---|---|
#8 | 2713709-send-html-email-from-rules-8.patch | 8.96 KB | mike.davis |
#6 | 2713709-send-html-email-from-rules-6.patch | 9.8 KB | mike.davis |
mail.png | 92.36 KB | webrelab | |
mailsystem.png | 55.21 KB | webrelab |
Comments
Comment #2
mike.davis CreditAttribution: mike.davis at Deeson commentedHi, thanks for using this module.
I have had a similar issue recently with a college of mine when using MimeMail to send HTML emails.
Due to the way that the email is generated in Drupal there are some incorrect headers set which means that the data sent to Elastic Email is incorrectly formatted.
My college has fixed this, but I have been waiting for him to post a patch.
I will chase him on this as this patch should then help you out with this too :).
Thanks
Mike
Comment #3
mike.davis CreditAttribution: mike.davis at Deeson commentedHi @webrelabs,
I have managed to get the patch from my college which I think will solve this issue. It is related to another issue that we were working on - #2657814: Separate plain text and html body value for sending emails with MimeMail, so I posted the updated patch to this thread.
Can you please test this patch and let me know how you get on and if this solves your issue?
I haven't fully tested it yet, only initially checked it over with my local dev copy, which seems to be working fine. One thing I have noticed is that it seems to always send using the provided theme rather than having a setting to determine if you want to send email as HTML or as plain text.
Please review and let me know if you have any further ideas about this etc. and/or provide an updated patch for this as this would be a great addition to this module.
Thanks
Mike
Comment #4
webrelab CreditAttribution: webrelab commentedHi @mike.davis
I'm trying this patch.
Patching output:
When I trying fired rules to send HTML email, I have same result, with additional email header in message body (default class in mail system - MimeMailSystem_ElasticEmailMailSystem). When I choose default class by ElasticEmailMailSystem - I get an fatal error "PHP message: PHP Fatal error: Call to undefined function elastic_email_prepare_message() in /var/www/bn/sites/all/modules/elastic_email/lib/elastic_email.mail.inc on line 36"
Comment #5
mike.davis CreditAttribution: mike.davis at Deeson commentedOK I had created the patch against the dev copy which has got a couple of additional minor commits.
I'll have a look at creating a patch against the 7.x-2.0 tag
Comment #6
mike.davis CreditAttribution: mike.davis at Deeson commentedHere is an updated patch against the 7.x-2.0 release, which should apply correctly against the 7.x-2.0 version.
Comment #7
webrelab CreditAttribution: webrelab commentedI get an fatal error
Comment #8
mike.davis CreditAttribution: mike.davis at Deeson commentedArgh sorry ... that'll learn me for trying to rush this :(.
OK, can you please try this one.
Comment #9
webrelab CreditAttribution: webrelab commentedI am very grateful to you for your help.
I get an warnings
When I trying fired rules to send HTML email, I have same result, with additional email header in message body (default class in mail system - MimeMailSystem_ElasticEmailMailSystem).
When I choose default class by ElasticEmailMailSystem - email recieved with empty message.
Comment #10
mike.davis CreditAttribution: mike.davis at Deeson commentedNo problems, happy to help with this :).
It seems to not be recognising the elastic_email.theme.inc file which should be there.
Is the the file '/var/www/bn/sites/all/modules/elastic_email/theme/elastic_email.theme.inc' on your server?
If so, have you cleared cache after applying the patch?
I haven't tried sending using rules, but sending normal emails from a site came through correctly using the HTML template.
If you send a email via the contact form for instance (which is using Drupals built in mail ti send rather than rules) does the email come through alright?
Comment #11
webrelab CreditAttribution: webrelab commentedPatch creates template files in module root folder. After moving it in theme folder, warning message is disappears. But, problem persist if I use contact form or if I use rules.
Comment #12
mike.davis CreditAttribution: mike.davis at Deeson commentedMmm.... looking at the patch it creates the templates files within the theme folder. I have just tested the applying of the patch it works correctly adding the files to relevant directory.
I haven't tried sending an email using Rules, but I will have a look at this when I get a chance. However send a standard email from the contact form seems to come through fine using the supplied HTML template correctly.
Can you revert the patch from your module so that you have the base version of 7.x-2.0 and re-apply the patch again to see if this works at all?
Comment #13
webrelab CreditAttribution: webrelab commentedMaybe I not understand how correctly use patch?
I'm downloading patch file into elastic_email module path and give command "patch < 2713709-send-html-email-from-rules-8.patch"
Template files create in module root folder
Comment #14
mike.davis CreditAttribution: mike.davis at Deeson commentedOK - it looks like you aren't quite applying the patch correctly. Details of how to apply patches can be found here - https://www.drupal.org/patch/apply
You are nearly there, just missing a flag on the patch command. You need to use:
patch -p1 < 2713709-send-html-email-from-rules-8.patch
This should then apply correctly without causing any problems. Let me know how you get on and if this then means that the email is sent correctly?
Comment #15
webrelab CreditAttribution: webrelab commentedWith flag -p1 patch working correctly. Message was sent with html template, but message was sent as text/plain.
Give me a short instruction about configuring modules - mailsystem, elastic_email, and whether to use mimemail module.
Comment #16
mike.davis CreditAttribution: mike.davis at Deeson commentedI'm glad you have managed to get the patch applying correctly. I've not used the module with Mimemail, but my understanding is that you should not need Mimemail as the ElasticEmail module handles the sending of the HTML email for you with this patch.
Can you try it without the Mimemail module enabled?
Comment #17
webrelab CreditAttribution: webrelab commentedI try again without mimemail module. After reinstall patched elastic_email module, when I receive email from contact form, or from rules - "Content-Type: text/plain; charset=utf-8"
Comment #18
webrelab CreditAttribution: webrelab commented@mike.davis, may have a way to change the type of pisma forced to html? What part of the code should be corrected, that would be the letters are always sent to html?
Comment #19
mike.davis CreditAttribution: mike.davis at Deeson commentedHi @webrelab, the module determines if the email should be sent as HTML or text based upon the headers that are parsed to it when the email is sent.
It sounds like something is setting the headers of the email to be HTML before it gets to the Elastic Email mailer as this is what determines it.
From what you have said, you are trying to send emails using rules and this is always sending the email as plain text - is that right?
Have you been able to send an email from the standard site contact form, as this would be sent through the Elastic Email mailer and the current patch sets all email to be HTML?
Thanks
Mike
Comment #20
timlie CreditAttribution: timlie as a volunteer commentedIs there any progress on this patch?
Patching version 2.2 of the module for drupal 7 does not work anymore.
I can confirm though that sending emails through rules are not send as html and thats very sad because elasticmail works really nice!
Comment #21
mike.davis CreditAttribution: mike.davis at Deeson commentedHi @timlie, there hasn't been any further progress made unfortunately as I hadn't received any details back from @webrelab.
It would be great to get this working with Rules.
Can you please provide the exact set up that you have (modules that you are using etc.) and how you have configured a Rules to send an email and I will have a look into this further to see what needs to be done for this.
Thanks
Mike
Comment #22
timlie CreditAttribution: timlie as a volunteer commentedHi Mike, thanks!
I'm using the following modules:
rules-7.x-2.9
commerce_email-7.x-2.x-dev
variable-7.x-2.5
I created a rule with action:
Send mail with Variable
This actions sends a preconfigured commerce email variable.
These variables are in full html.
When receiving the e-mail from elasticemail its plain text. Sending with mimemail and builtin php mailer sends them as html emails.
Comment #23
timlie CreditAttribution: timlie as a volunteer commentedHi Mike,
If I need to provide you with more info, just let me know!
Comment #24
timlie CreditAttribution: timlie as a volunteer commentedHi Mike,
May I ask if there is any movement for this issue?
Thanks!
Comment #25
mike.davis CreditAttribution: mike.davis at Deeson commentedHi @timlie,
Sorry I haven't had much time to be able to have a look at this recently. I'll try and see if I can squeeze in some time to have a look at this.
Thanks
Mike
Comment #26
timlie CreditAttribution: timlie as a volunteer commentedHi Mike,
I managed to send the emails in html with htmlmail (7.x-2.65 version).
Thanks!