Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#17228 closed defect (bug) (fixed)

Error: Could not instantiate mail function

Reported by: vegasgeek's profile vegasgeek Owned by:
Milestone: 3.2 Priority: normal
Severity: normal Version: 3.2
Component: Mail Keywords: needs-patch
Focuses: Cc:

Description

WP Version: 3.2-bleeding (rev 17693)

Error Message:
Could not instantiate mail function. Could not instantiate mail function. Could not instantiate mail function.
Warning: Cannot modify header information - headers already sent by (output started at /var/www/wpcore/wp-includes/class-phpmailer.php:586) in /var/www/wpcore/wp-includes/pluggable.php on line 885

Process to reproduce:
In network admin, Add site. After submiting new site details, the above error message shows up.

Notes:
This is running on my local dev server that does NOT have mail functionality turned on. Although it's no surprise that it can't send email, this error message is new as of the past 3 days (sorry I don't know the previous revision number I was on). Prior to an SVN UP a couple days ago, adding new sites would work fine and the mail portion would fail gracefully.

Attachments (1)

17228.diff (1.8 KB) - added by ryan 13 years ago.

Download all attachments as: .zip

Change History (8)

#1 @vegasgeek
13 years ago

Forgot to mention, the new site gets created successfully.

#2 @dd32
13 years ago

This will be related to the new PHPMailer version: #15912

#3 @dd32
13 years ago

basically, PHPMail now uses exceptions.

Here's an example of a API function:

    if (!self::ValidateAddress($address)) {
      $this->SetError($this->Lang('invalid_address').': '. $address);
      if ($this->exceptions) {
        throw new phpmailerException($this->Lang('invalid_address').': '.$address);
      }
      echo $this->Lang('invalid_address').': '.$address;
      return false;
    }

So other than modifying phpmailer to remove all the echo's for any failure of any kind, we can wrap every API call in a try {}..

#4 @dd32
13 years ago

  • Component changed from Network Admin to Mail
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.2
  • Version changed from 3.1 to 3.2

@ryan
13 years ago

#5 @ryan
13 years ago

We could probably ignore and continue instead of return in some of those places.

#6 @ryan
13 years ago

Yep, the destinations can all be continues. If all destinations end up empty then Send() will throw an exception and we'll catch that and return false. This is more in line with previous behavior.

#7 @ryan
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [17753]) Use exceptions with phpmailer to avoid headers already sent errors. fixes #17228

Note: See TracTickets for help on using tickets.