<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi all,<div><br></div><div>I'm using the messaging &amp; notifications modules, and have redirected the Drupal system emails with drupal_mail_wrapper() to travel through the messaging_phpmailer framework.</div><div>This enables the client's "lost password" emails to travel via gmail, for example, which is the the same account their notifications are sent.</div><div><br></div><div>Anyway, I have this working except for line breaks. The final "lost password" email arrives as a single line, with no breaks.</div><div><br></div><div>I've added a debugging routine that appends a string to a file, and with that writing out the email body as it travels into the messaging_phpmailer logic I can see line breaks starting as "\r", get converted to "\n" before being sent, and lost somewhere during the send process. However, emails sent through the same logic by the messaging module have line breaks and complete rich text just fine.</div><div><br></div><div>It looks like the only place the change could occur is inside hook_mail_alter(), but a grep of my contributed modules is not showing any implementations of "_mail_alter"...</div><div><br></div><div>Anyone have any experience / advice?&nbsp;</div><div><br></div><div>The necessary logic to do this is quite simple, once the messaging framework has been setup:</div><div><br></div><div>// the only thing inside cex_mail.module:</div><div><div>function cex_mail_enable() {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>variable_set('smtp_library', drupal_get_path('module','cex_mail') . '/smtp.inc.php');</div><div>}</div><div><br></div><div>// contents of smtp.inc.php:</div><div><div>function drupal_mail_wrapper($message) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre"></span><span class="Apple-tab-span" style="white-space:pre">        </span>// simply appends string to a file:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>_cexReport( 'drupal_mail_wrapper: got "'.print_r( $message, 1 ).'"' );</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>// tried all kinds of variations here, nothing seems to make a difference:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$message['body'] = str_replace( "\r", '', $message['body'] );</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>return messaging_phpmailer_send_msg( $message['to'], (object)$message, $message['params'] );</div></div><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-family: Helvetica; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div>}</div><div><br></div><div>With the exception of the line break issue, this works fine.&nbsp;</div><div><br class="Apple-interchange-newline">Sincerely,</div><div>-Blake</div><div><a href="mailto:bsenftner@earthlink.net">bsenftner@earthlink.net</a></div><div><a href="http://www.BlakeSenftner.com">www.BlakeSenftner.com</a></div><div><a href="http://www.MissingUbercartManual.com">www.MissingUbercartManual.com</a></div></span></span></div>
</div>
<br></div></body></html>