/**
* Filters the name to associate with the "from" email address.
*
* @since 2.3.0
*
* @param string $from_name Name associated with the "from" email address.
*/
$from_name =
apply_filters( 'wp_mail_from_name',
$from_name );
try { $phpmailer->
setFrom( $from_email,
$from_name, false
);
} catch ( PHPMailer\PHPMailer\Exception
$e ) { $mail_error_data =
compact( 'to', 'subject', 'message', 'headers', 'attachments'
);
$mail_error_data['phpmailer_exception_code'
] =
$e->
getCode();
/** This filter is documented in wp-includes/pluggable.php */
do_action( 'wp_mail_failed',
new WP_Error( 'wp_mail_failed',
$e->
getMessage(),
$mail_error_data ) );
return false;
} // Set mail's subject and body.