This page redirects to an external site: https://developer.wordpress.org/reference/hooks/wp_mail/
The wp_mail filter hook allows you to filter the arguments that are passed to the wp_mail() function. The arguments for wp_mail() are passed through the filter as an array.
add_filter( 'wp_mail', 'my_wp_mail_filter' );
function my_wp_mail_filter( $args ) {
$new_wp_mail = array(
'to' => $args['to'],
'subject' => $args['subject'],
'message' => $args['message'],
'headers' => $args['headers'],
'attachments' => $args['attachments'],
);
return $new_wp_mail;
}
$attachments should be an array. If it is not, it will be converted to one by the wp_mail function after the filter.
Since: Version 2.2
$attachments argument added in Version 2.7
wp_mail is located in wp-includes/pluggable.php