If i use some text format the check_markup function that use a format where line break is set the html mail will be bad.
I tryed to figure out this and what i found is if drupal_wrap_mail() run before check_markup() that uses line break set the html text goes wrong.
So i think the check_markup function should be ran in mail_alter function so drupal_wrap_mail will be called after this.
What happens is the following:
Original link after !url is replaced
activate
reigstration
call drupal_wrap_mail() there is a break between
href="http://www.example.com/user/validate/27/133405660/633061349343256caab094404e6bf5">activate
reigstration
and call check_markup after it that mess the text with
href="http://www.example.com/user/validate/27/133405660/633061349343256caab094404e6bf5">activate
reigstration
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | mimemail_1128354_03.patch | 3.22 KB | sgabe |
| #5 | mimemail_1128354_01.patch | 1.84 KB | sgabe |
Comments
Comment #1
mibfire commentedi forget the automatic links convert
If i use
<a href="!url">some text</a>format the check_markup function that use a format where line break is set the html mail will be bad.I tryed to figure out this and what i found is if drupal_wrap_mail() run before check_markup() that uses line break set the html text goes wrong.
So i think the check_markup function should be ran in mail_alter function so drupal_wrap_mail will be called after this.
What happens is the following:
Original link after !url is replaced
call drupal_wrap_mail() there is a break between
<a and hrefand call check_markup after it and that mess the text with
<br>Comment #2
mibfire commentedIt should work like in html mail module.
Comment #3
royiby commentedI am experiencing the same issue and it's a real downer....any suggestions on how could i fix it?
edit: i forgot to point out that i am experiencing it on the latest release ie beta2
Comment #4
thomasmurphy commentedsubscribing
Comment #5
sgabe commentedI think we should move the check_markup() call to hook_mail() instead of hook_mail_alter() which is called for all messages. Please test the attached patch and report back.
Comment #6
sgabe commented#506112: wrong line wrapping on drupal_wrap_mail() in mail.inc is marked as a duplicate of this.
However, we need to remove the check_markup() call from drupal_mail_wrapper().
Comment #7
sgabe commentedIn the following patch I moved the check_markup() call from drupal_mail_wrapper() into hook_form_alter(). We need this to create HTML versions of plain text system messages, but we need to check if the message needs to be converted to HTML format or not.
Comment #8
sgabe commentedLets move this to D7.
Comment #9
Sarenc commentedpatch in #7 works great for me. Mime mail wasn't converting line breaks to br tags at all before implementing this patch.
Comment #10
moshe weitzman commentedCode looks good. Have not verified that it fixes the bug.
Comment #11
mrbubbs commentedI would like to confirm the patch in #7 works for me too. I've patched against Mime Mail 6.x-1.0. The HTML portion of the email now has complete lines that aren't broken in the browser except for intended breaks inserted with ckeditor.
I implemented the exact same solution before I found this post! It would be nice if the patch could eventually be included with the 6.x branch. I think this would be classified as a bug, not a feature. I have several annoyed end-users complaining about weird wrapping HTML email. I'll be manually applying this patch to fix the issue for now.
Comment #12
moshe weitzman commentedComment #13
ezra-g commented#7 does not apply to 6.x-2.x or 6.x-2.0.
Comment #14
mrbubbs commentedWhen will this make it into 6.x?
Comment #15
langworthy commentedHow about 7.x? I'm trying to get something like #7 for 7.x but I can't figure out where the second part of the diff for mimemail.module would go.
Comment #16
raphaelhuefner commentedIn order to handle at least the mails of
user.modulein Drupal 7, I came up with thishook_mail_alter()implementation:Where "mymodule" would be the name of a custom module of your own. Yep, it's just a work-around, not a real solution.
Comment #17
hanskuiters commentedThanks @raphaelhuefner for this work-around.