Welcome Guest, Not a member yet? Register   Sign In
Linefeeds in Email Headers

We've ran into some problems with Qmail not sending emails because of linefeeds in headers. Changing the linefeed to "\r\n" helped, but we then ran into some problems with bare LFs in the body (Yahoo, among others, rejected the email).

More tweaking, and re-reading RFC822, and we've got qmail sending, yahoo and almost everyone else receiving.

Then we find some users are still not getting email:

"This Email scanner intercepted it and stopped the entire message
reaching its destination.

The policy-violation was reported to be:

Disallowed breakage found in header name - not valid email

As far as I can tell, we can't do anything. If we change the LF's in the header, then qmail won't send. It is the MTA on the user's end that is wrong.

Does anyone have any insight into this issue?

Sorry to bump my own post, but, does anyone have any suggestions?

[eluser]Derek Jones[/eluser]
What version of CI are you running, and do you have any hacks in place? Do you have the same problem with sendmail/SMTP?


Thanks for looking into this!

Using SMTP with authentication, Codeigniter 1.6, but have worked with the newest email library, to no avail.

Server is a pretty standard LAMP CentOS/Qmail setup at Servint.

It all comes down to the newline and crlf values.

$newline = "\r\n";
$crlf = "\r\n";

This works for almost everyone, except some servers return the email complaining about invalid headers.

If I change crlf to '\n', qmail refuses to send it:

Qmail fails with:
'451 See http://pobox.com/~djb/docs/smtplf.html.
The following SMTP error was encountered: 451 See http://pobox.com/~djb/docs/smtplf.html.
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.'

If I then try:

$newline = "\n";
$crlf = "\r\n";

It works, except major ISP's like Yahoo and Comcast reject the mail.

[eluser]Derek Jones[/eluser]
I honestly have no idea what qmail might be doing with the emails after CI hands it off. If I had to guess, based on things we've seen on some servers (particularly eastern european), the SMTP server is trying to force compliant line breaks by blindly converting either \r or \n to \r\n, which obviously can lead to problems of having double or even quadruple line breaks littered in your email. My recommendation would be to try a different SMTP server, or preferably sendmail, so you can eliminate any issues in the email library or your application. Or check with your qmail administrator to help you examine the issue and see if there is any post-hand-off conversion taking place, and how to either work around it or disable it.

I just had to remove \r\n from an old CI 1.5 app. Haven't found out from the user what their email setup was, but in Lotus Notes the line feed showed up as non-alphanumeric characters. That was my only clue as to why the email system was failing for a few users. My assumption is that the email got clipped at the first \r\n. Unfortunately, password info followed the line feed, so a few users weren't getting their reset code (yipe!)

Gotta love CI, though. Wasn't even my code, but I was able to zero in on the culprit in a couple of minutes. Frameworks+1

Theme © iAndrew 2016 - Forum software by © MyBB