Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I need to be able to force the module to parse HTML emails, if I send them as they are currently I just see the actual HTML code.
Comment | File | Size | Author |
---|---|---|---|
#4 | signup.patch | 3.99 KB | yoav_y |
#6 | signup.patch | 3.67 KB | yoav_y |
Comments
Comment #1
dwwthis module doesn't parse emails at all, so i have no idea what you're asking for. please provide more info about what you're talking about, or no one is ever going to be able to help make it happen (if it's appropriate for this module at all).
Comment #2
MikeyGYSE CreditAttribution: MikeyGYSE commentedThis module sends emails out, in the form of signup confirmations and reminders, I want those emails to be sent in HTML format - so that they can include a header image and a formatted footer containing our legal information. Is it possible to do that?
Comment #3
dwwthanks for clarifying what you're asking for. not currently possible, no. however, i have no use for this feature (and generally detest HTML email, anyway) so you'll either have to provide a patch yourself, or hire someone to write it. ;)
good luck,
-derek
Comment #4
yoav_y CreditAttribution: yoav_y commentedThe attached patch for 6.x-1.x-RC3 will allow you to use HTML and CSS within emails, but ONLY if you also have the mimemail (http://drupal.org/project/mimemail) module installed. Otherwise it will behave exactly as before.
Mimemail allows users to specify if they prefer plaintext or html e-mails, and this will behave as expected.
Hopefully this resolves your issue...
edit : ignore this patch and use the one further down please
Comment #5
dww@yoav_y: Thanks for the patch. When you post something that you want the maintainer (me) to review, please set the status to "needs review"...
However, this "needs work" for a few reasons on a quick skim of the patch:
A) Please use a "unified diff" (e.g. "cvs diff -up") when creating a patch, which makes it easier to read and review. See http://drupal.org/patch/create for more info.
B)
function mail_token_fixup()
needs to start with "signup" in the name to avoid potential namespace conflicts. In other words, it should at least be namedfunction signup_mail_token_fixup()
. I haven't looked closely or thought about it at all, so maybe it needs a better name than that, but that's a start in the right direction. ;)If/when you post a new patch to correct these things, set the status back to "needs review". If it's good and people test it and it works, I'll commit it, otherwise, I'll set it back to "needs work" and explain why.
Cheers,
-Derek
Comment #6
yoav_y CreditAttribution: yoav_y commentedOk fixed as per-requested.
the mail_token_fixup was just a convenience function that was initially part of the mail hook but that needed to be called for the mimemail functions too, so I called it that. I renamed it to signup_mail_token_fixup -- although I suppose any of a million other names work too.. I'll be happy to rename more if you like.
unified diff posted (sorry, context diff is the one I'm used to).
switching to needs review
Comment #7
yoav_y CreditAttribution: yoav_y commentedodd it didn't take. Trying needs review again.
Comment #8
Summit CreditAttribution: Summit commentedsubscribing, greetings, Martijn
Comment #9
dwwActually, looking more closely at mimemail.module, I don't see why this patch is needed. Mimemail provides a setting to hijack all email sent by your site and pipe them through mimemail instead of the standard drupal mail delivery function. Why can't you just install, enable, and configure mimemail to handle email for your site and be done with it? Why should signup conditionally test for the existence of mimemail and call mimemail() directly?
Also, note that
is a code-style bug. It should be:
Comment #10
yoav_y CreditAttribution: yoav_y commentedIf you try enabling mime mail and tell it to simply trap all system mails and use mimemail for it, you will see that the signup emails get royally borked (the subject line will get split up incorrectly, and several tokens will be misparsed). That's what prompted me to write the little patch....
I apologize for the coding style issues...
Anyways, I'm not really sure what you're asking. If you want me to clean up the code style and resubmit as a patch I'm happy to. I'm fairly sure that just installing mimemail and not including this patch does not work (someone else may want to chime in, but it certainly isnt working for me). If you'd rather not support mime mails (at least via the mimemail module) then there's not much I can offer here. I believe the patch is about as non-invasive as can be (certainly if you don't have mimemail installed nothing changes).
I see that in future versions you're planning on splitting off the email functionality anyways, so perhaps that is the more appropriate place for worrying about mime support (and leaving it broken in the current release). Was only trying to help when I noticed others had also asked about mime support, but it's your module and your call...
Comment #11
dwwI was just trying to understand why this was needed, that's all. Yes, I'd like to overhaul email handling completely, but this is a small change, and if it makes mimemail work, I'd be in favor of committing it before the next release. I'd still like to understand why things don't just work naturally if you enable mimemail. Meanwhile, if anyone else wants to test this, I'd appreciate it. Thanks!
Comment #12
yoav_y CreditAttribution: yoav_y commentedWell, the biggest issue with the code as written is the line:
$message['body'][] = drupal_html_to_text($body);
Which strips out a bunch of the tags that you would want to keep for mime mail. by calling mime_mail instead of the regular mail_hook we don't strip it (and instead let the mime mail module decide what is safe and what is not safe to pass).
Comment #13
dwwHave you updated your signup code in the last few months? ;) See #356968: Line feeds stripped from confirmation email
Can you try this again with RC4? and/or the latest code in the DRUPAL-6--1 branch?
Comment #14
yoav_y CreditAttribution: yoav_y commentedtrying RC-4 without patch right now..
Comment #15
yoav_y CreditAttribution: yoav_y commentedHey cool. Ok with the override turned on, it looks like mime emails are going through correctly (apart from an extra carriage return at the end of the subect line).
So patch no longer required. yay...
Comment #16
dwwExcellent. Glad to hear it.
Comment #17
johnnydarkko CreditAttribution: johnnydarkko commentedGlad to hear that rc4 works right but it seems like we're having the same behavior with rc6 with emails displaying HTML code. Does 6.x-1.0 include the fix in rc4?
Comment #18
johnnydarkko CreditAttribution: johnnydarkko commentedeh... its still showing HTML code when I updated from rc6 to 6.x-1.0. I ended up just turning fckeditor off.