Make WordPress Core

Opened 9 years ago

Last modified 2 years ago

#21738 new defect (bug)

PHPMailer fourth argument '-oi' does not work with some hosts with safe_mode off

Reported by: Keeslavin Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: Mail Keywords: needs-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

See also #20970

Some hosts (e.g. TransIP) do not accept the '-oi' parameter in the fourth argument for mail() even when safe_mode is off.
The result is that no mail can be sent through WordPress on these hosts.

Changeset [21129] provides a partial fix when either safe_mode is off, or no sender is defined.

The parameter seems to be unnecessary, therefore it is recommended to remove this parameter. In version 3.4 and 3.4.1, it is in lines 740 and 742 of file wp-includes/class-phpmailer.php

Attachments (1)

class-phpmailer.php (82.3 KB) - added by Keeslavin 9 years ago.

Download all attachments as: .zip

Change History (13)

9 years ago


#1 @SergeyBiryukov
9 years ago

  • Description modified (diff)
  • Keywords needs-patch added

#3 follow-up: @markoheijnen
9 years ago

Can't this be closed as duplicate of #21074?

#4 in reply to: ↑ 3 @nacin
9 years ago

Replying to markoheijnen:

Can't this be closed as duplicate of #21074?

Doesn't seem like it. #21074 is designed to merge in PHPMailer latest which will include the upstream-formatted fix for [21129].

This ticket seems to be more about never using the fourth argument of mail().

On these hosts, does mail() fail in this situation? Perhaps if could be as simple as this:

if ( ! mail( one, two, three, four ) )
    mail( one, two, three );

#5 @bpetty
9 years ago

It's a reported bug a in an external library which should be reported and fixed upstream, and in this case, it was already reported and dealt with upstream, who's fix is already making it downstream in #21074.

However, for the fix to actually work, WordPress needs to either set $phpmailer->UseSendmailOptions = false in wp_mail() by default (it's on by default), or it needs to expose the setting in some other way (turn on/off depending on new wp-option). Keep in mind that if it's turned off by default, it's not be a big deal that "-oi" isn't used, but "-f" won't be used either, and I believe that could break mail on more hosts than this fixes by turning it off.

So, it's not a duplicate, but it does depend on #21074.

#6 @nacin
9 years ago

Yeah, I don't think UseSendmailOptions = false is a good idea. But it would be nice if we could re-try a mail() call without sendmail options, if we can determine that the mail() with sendmail options failed.

#7 @bpetty
9 years ago

  • Cc bpetty added
  • Milestone changed from Awaiting Review to Future Release
  • Severity changed from normal to minor

I'll re-visit this ticket with a possible patch (hopefully with nacin's approach) after #21074 has been taken care of, in the mean time though, this is on the back burner.

#8 @bpetty
8 years ago

Turns out that upstream PHPMailer decided to remove these -oi options afterall, so this can be closed if #25014 is applied.

#10 @SergeyBiryukov
8 years ago

  • Keywords needs-patch removed

#11 @bpetty
8 years ago

  • Keywords needs-patch added

Er, sorry for the confusion, I was wrong. #25014 only removes "-oi" from SendMail(), which is only used with PHP mail(). The use of "-oi" inferred here should actually be from SendmailSend(), which does still use it.

#12 @chriscct7
6 years ago

  • Severity changed from minor to normal
  • Version changed from 3.4.1 to 3.4
Note: See TracTickets for help on using tickets.