Hey guys,
I have a little problem where when the subject line is more than 77 characters. it will try to put a new line and continue the text but because of a particular line in mimemail_prepare_message($message) function (line:530).
$subject = str_replace(array(" \n", "\n"), '', trim(drupal_html_to_text($subject)));
The "/n" gets removed and i end up with something like this.
"12 January 2014" becomes "12January 2014"
drupal_html_to_text(); calls drupal_wrap_mail(); calls _drupal_wrap_mail_line(); this is where the "\n" gets added.
I hope all this makes sense. Thank you in advance.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | mimemail-2185909.patch | 1.43 KB | cyrus_bt5 |
Comments
Comment #1
cyrus_bt5 commentedComment #2
sgabe commentedThat line was added by #1605230: Extra space in subject caused by wordwrap, so this needs more investigation. Another possibly related issue is #380334: Extra space in Subject and Reply-to headers.
Comment #3
cyrus_bt5 commentedHi sgabe, thanks for getting back to me so quickly. I have had a look at the other two issue queues and created my own patch from all the comments. Everything is working as it should now. Cheers.
Ref #1605230 , #380334
Comment #4
cyrus_bt5 commentedComment #5
sgabe commentedCommitted, thanks!
Comment #7
knalstaaf commentedI'm still having this issue in 7.x-1.0-beta4.
Comment #8
gaëlgYes, I face this too. I looked further and here's what happen to me.
In mimemail_prepare_message(), the $subject before the call to drupal_html_to_text() is:
(Note the space after "Poste" and before the new line)
It goes into drupal_html_to_text() and stays as-is (in $chunk) until the call to:
Then, in drupal_wrap_mail(), it stays as-is until the call to:
After this, $text is:
(The trailing space is removed)
So that finally, in mimemail_prepare_message(), at this call:
$subject = str_replace(array("\n"), '', trim(drupal_html_to_text($subject)));... $subject ends up to:
[MadeInScop] Nouveau sujet "Recrutement Assistant(e) Marketing en CDI - Posteà pourvoir immédiatement"(A space is missing between "Poste" and "à")
I don't yet know where the code should not behave as it does.
Comment #9
gaëlgActually the problem is before: the subject shouldn't have this newline when entering mimemail_prepare_message(). It's Mail Edit which truncates it by calling drupal_html_to_text() in _mail_edit_mail_alter().
Comment #10
gaëlgI made a patch in #2735109: Some spaces disappear from long mail subjects (at least when using Mimemail)
Comment #11
knalstaaf commentedPlease don't get too jumpy when it comes to closing topics. I'd like to hear confirmation of others first, especially from the maintainers.
Comment #12
salvisI've just published Mail Editor 7.x-1.2 including the patch mentioned above.