Make WordPress Core

Opened 19 years ago

Closed 18 years ago

#2603 closed defect (bug) (invalid)

Illegal CR-LF sequence sent to mail on Unix

Reported by: juliano's profile juliano Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0.2
Component: General Keywords: Microsoft Outlook wp_mail email mail wrap wordwrap LF CR SMTP has-patch
Focuses: Cc:

Description

The pluggable function wp_mail uses PHP's mail function.

According to Ben Cooke, the mail function requires different input when it is running on different operating systems: On Windows systems, you need to use the CR-LF, the Windows convention and as defined in the SMTP email standard. On Unix systems, you need to use the traditional Unix LF only - it will convert to use the CR-LF style that is required to send down the wire.

The Unix system will replace all of the LF characters into CR-LF, even if there is already a CR preceding it. That means a CR-LF sequence will be broken (Ben Cooke describes it as “hypercorrected”) into a CR-CR-LF sequence.

Many email clients accept the CR-CR-LF sequence without blinking.

However, Microsoft Outlook gets confused by this sequence. It doesn't accept headers that use this sequence (they get moved into the body) and it doesn't recognize end-of-paragraph markers.

The result is that emails from WordPress format poorly in Outlook.

I see three possible solutions:

1) Blame Microsoft Outlook. This is a popular option, but seems unfair given WordPress is failing to conform to the expected input of mail.

2) Put an OS-dependent check, and replace all the CR-LF with LF on a Unix system.

3) Use one of the available replacements for PHP's mail function which allegedly deal with these platform issues more gracefully. PHPMailer?

Attachments (1)

2603.diff (1.9 KB) - added by Nazgul 19 years ago.

Download all attachments as: .zip

Change History (8)

#2 @juliano
19 years ago

  • Summary changed from Illegal CR-LF sequence sent to @mail on Unix to Illegal CR-LF sequence sent to mail on Unix

#3 @juliano
19 years ago

I have now written a plugin, called CRCRLF, to work around this issue.

@Nazgul
19 years ago

#4 @Nazgul
19 years ago

  • Keywords has-patch added
  • Milestone set to 2.1

I created a patch based on the given plugin code.

#5 @matt
18 years ago

  • Milestone changed from 2.1 to 2.2

#6 @foolswisdom
18 years ago

  • Milestone changed from 2.2 to 2.3

#7 @rob1n
18 years ago

  • Milestone 2.3 deleted
  • Resolution set to invalid
  • Status changed from new to closed

We use PHPMailer now.

Note: See TracTickets for help on using tickets.