function set_return_path() {
global $phpmailer;
if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) {
require_once ABSPATH . WPINC . '/class-phpmailer.php';
require_once ABSPATH . WPINC . '/class-smtp.php';
$phpmailer = new PHPMailer();
}
$phpmailer->Mailer = 'sendmail';
$phpmailer->Sender = 'hoge@example.com';
}
add_action( 'init', 'set_return_path' );
ただし、このままだと sendmail によって X-Authentication-Warningフィールドが付加される可能性あり。
対策しておきましょう。
304 – narucissus is Not Modified: X-Authentication-Warningフィールドの制御
コメントを残す