WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6861 closed defect (bug) (wontfix)

class-phpmailer.php default configuration

Reported by: lotabi Owned by:
Milestone: Priority: low
Severity: normal Version:
Component: Optimization Keywords:
Focuses: Cc:

Description

In file class-phpmailer.php some "PUBLIC VARIABLES" are defined but these VARIABLES should be defined in main WP configuration file for these reasons:

1- WP admin want use main config file (wp-config.php)
2- define VARIABLE in class-phpmailer.php will be overwrite in SVN update

class-phpmailer.php provide 5th params in mail() function, but are not usable if VAR $Sender is not set. I suggest set default value to $Sender = $_SERVERSERVER_ADMIN?

In some situation (suphp and virtual user) WP are not be able to send email and local mail server report this error:

Apr 28 10:00:50 smtp postfix/sendmail[2220]: fatal: no login name found for user ID 3334

Change History (2)

comment:1 @MattyRob7 years ago

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

phpMailer is called in WordPress as a class. All of these variables can be changed using a plugin to redefine the variables and therefore any changes to the defaults should be made in the wp_mail() function in pluggable.php.

Defining them in wp-config may cause conflicts with plugins that already over ride the default function.

The solution to your issue would be a plugin file as follows:

add_action('phpmailer_init', 'wp_mail_to_smtp');

function wp_mail_to_smtp(&$phpmailer) {

$phpmailer->Sender = 'send@…';

}

comment:2 @westi7 years ago

  • Milestone 2.7 deleted

Indeed you can and plugins exist to help you configure phpmailer for your environment.

http://www.callum-macdonald.com/code/wp-mail-smtp/

Note: See TracTickets for help on using tickets.