0

我想自定义电子邮件的发件人,所以我试图正确设置电子邮件的标题。

这是我用来自定义标题的 cos:

$current = wp_get_current_user();
global $user_email;
get_currentuserinfo();
$headers_mail = "From: ".$current->first_name." ".$current->last_name." <".$user_email.">" . "\r\n";

这是我用来发送电子邮件的原因:

wp_mail($email, $subject, $message, $headers_mail);

不幸的是,电子邮件的发件人始终设置为“WebsiteTitle”,其中 WebsiteTitle 是网站真实标题的别名,而 mydomain.com 是网站真实域名的别名。

如何覆盖电子邮件的标题?有什么我应该使用的过滤器吗?

4

2 回答 2

0

解决了。我使用了 wp_mail_from 和 wp_mail_from_name 过滤器。可以在此处找到出色的文档http://adambrown.info/p/wp_hooks/hook/wp_mail_from?version=3.2&file=wp-includes/pluggable.php和此处http://adambrown.info/p/wp_hooks/hook /wp_mail_from_name?version=3.2&file=wp-includes/pluggable.php

于 2011-09-28T13:50:27.687 回答
0

您还可以使用出色的WP Mail SMTP插件

于 2011-09-29T09:25:43.673 回答