Hey,
I was not able to send email via using the Invite Module. I traced down the problem to “linebreak”. I think the official documentation says line break should be “\r\n” for smtp. But I think “\n” and “\r\n” works on mail servers I know.

Invite Module
...
if ($success = user_mail($email, $subject, wordwrap($body, 72), "From: $from\r\nReply-To: $replyto")) {
...

User module:
...
$headers = "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from";
$mail_success = user_mail($account->mail, $subject, $body, $headers);
...

In user_mail_wrapper() smtp module does this:
$header_array = explode("\n", $header); //Adds each line of the header as an array element.

This only takes care of “\n” case not the “\r\n” case. I guess my correction would be:

$linebreak = "\r\n";
$pos = strpos( $header, $linebreak );
if ( $pos === false )
{
$header_array = explode("\n", $header);
} else {
$header_array = explode("\r\n", $header);
}

instead of “$header_array = explode("\n", $header);”

This is my first time posting. Still getting familiar with the posting rules. The site is huge. I think this is the right place to post but feel to advice.

Comments

vm’s picture

yep you are placing your post in the correct thread, however you may want to create a patch file and attach it to this thread so that the dev can easily roll your patch if so chosen.

more information on creating patches can be found here http://drupal.org/node/22568

LukeLast’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Needs review » Fixed

HEAD has been updated to check for "\r\n".

Anonymous’s picture

Status: Fixed » Closed (fixed)