Closed (fixed)
Project:
Drupal core
Version:
5.0-rc1
Component:
user.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Sep 2005 at 08:52 UTC
Updated:
16 Apr 2008 at 23:19 UTC
There is a line in user.module user_mail() that removes \r from the email body:
str_replace("\r", '', $message),
To make the email comply with the standards the str_replace should be removed. Some unix based mail servers will ignore the lack of the \r while others reject the email as invalid.
If you want to fix the occasional wierd line ending from editors on different operating systems, the following are useful. The following fixes text from some editors that forget the \r while maintaining the \r\n from standards compliant email editors.
str_replace("\r\r\n", "\r\n", str_replace("\n", "\r\n", $message));
Comments
Comment #1
sepeck commentedI've seen this bug on a Drupal 4.6.5 install with my site. I am wondering if it is part of the the intermittant missing mail issue Drupal.org has sending new passwords.
Comment #2
killes@www.drop.org commentedI've sent myself a drupal.org password reminder and captured the traffic using tcpdump. Looking at the dump with ethereal by myself and somebody who knows what it should look like reveals that the mail is ok and that people not getting mail probably have issues with their spamfilters.
I am inclined to mark this "won't fix".
Comment #3
peterx commentedThe problem was in mail going out. It failed at the first mail server without passing through a spam checker.
I removed the mailer module in preparation for an upgrade to 4.7.0. I will add the mailer module back after 4.7.0 and report the problem again if it exists in 4.7.0.
Comment #4
dries commentedI'm trying the suggested fix in drupal.org. Let's see if that stops some of the user registration problems.
Comment #5
killes@www.drop.org commentedI am bit confused now. Which mailer module are ou talking about? Did you have n external smtp server set up?
Comment #6
peterx commentedI am trying 4.7.0 beta 6 for a new site. Here is the error message for email before I apply the fix.
warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in /home/example.com/web/modules/user.module on line 400. This is the same error message as displayed in 4.6.
Comment #7
chx commentedkilles, Dries where are we with this bug?
Comment #8
gerhard killesreiter commentedI am not 100% sure, but I /think/ it is fixed in HEAD.
Comment #9
chx commentedGerhard, this code snippet is not touched in HEAD.
Comment #10
itsme213 commentedOn win-XP using apache2triad I got the same SMTP error message.
When I replaced the line in user.module:
str_replace("\r", '', $message),
with
str_replace("\r\r\n", "\r\n", str_replace("\n", "\r\n", $message)),
the error message disappeared and the email was sent fine.
(I also tried replacing the line with just $message; it did not fix the problem).
Comment #11
magico commentedStill a problem?
Comment #12
magico commentedComment #13
peterx commentedThe problem occurs with Drupal 5 RC1 in includes/common.inc drupal_mail() about line 1947. Replace:
str_replace("\r", '', $body),
with:
str_replace("\r\r\n", "\r\n", str_replace("\n", "\r\n", $body)),
petermoulding.com/web_architect
Comment #14
GravitySpec commentedThanks for posting this peterx.
This issue was still present in our version 5.6 copy which now uses drupal_mail() in the includes/common.inc file. Your fixed worked like a charm and now our e-mails are getting through to the more strict servers.