Ticket #2603 (closed defect: invalid)

Opened 2 years ago

Last modified 1 year ago

Illegal CR-LF sequence sent to mail on Unix

Reported by: juliano Assigned to: anonymous
Priority: normal Milestone:
Component: General Version: 2.0.2
Severity: normal Keywords: Microsoft Outlook wp_mail email mail wrap wordwrap LF CR SMTP has-patch
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

2603.diff (1.9 kB) - added by Nazgul on 10/03/06 14:33:41.

Change History

03/27/06 08:41:06 changed by juliano

03/27/06 23:47:33 changed by juliano

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

04/01/06 13:47:34 changed by juliano

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

10/03/06 14:33:41 changed by Nazgul

  • attachment 2603.diff added.

10/03/06 14:35:08 changed by Nazgul

  • keywords changed from Microsoft Outlook wp_mail email mail wrap wordwrap LF CR SMTP to Microsoft Outlook wp_mail email mail wrap wordwrap LF CR SMTP has-patch.
  • milestone set to 2.1.

I created a patch based on the given plugin code.

12/01/06 02:46:00 changed by matt

  • milestone changed from 2.1 to 2.2.

03/27/07 20:57:32 changed by foolswisdom

  • milestone changed from 2.2 to 2.3.

05/01/07 13:33:36 changed by rob1n

  • status changed from new to closed.
  • resolution set to invalid.
  • milestone deleted.

We use PHPMailer now.