I want to pass some additional data (ie the admin email address) every a mail is sent from WordPress.
If my web site was based on pure PHP, I would have to set parameter additional_parameters
to -f me@domain.com
. More info here .
However, my web site is based on WordPress and so I have to find another way to pass the additional parameter (ie the admin email address) to wp_mail()
function.
How can I do that in Wordpress?
wp_mail
allows you to provide headers to the email. If you use the From
header, you can specify who the email is from.
$headers = array('From: ' . get_option('admin_email'));
wp_mail('recipient@example.com', 'Email subject', 'Email Body', $headers);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.