admin管理员组文章数量:1290984
I want to set the SMTP settings manually instead of using a plugin. I did this using this resource. However, there is a problem. If the user clicks "Reply", a different e-mail appears. Probably I've described this before with the plugin. However, I cannot remove it. If I make a new definition as below, it creates a new reply e-mail. Therefore, the past is not erased. What I want: If the user clicks to reply to the incoming e-mail, only smtp_from e-mail should appear.
My Codes:
wp-config.php
define ('SMTP_FROM', '[email protected]');
...
function.php
add_action ('phpmailer_init', 'my_phpmailer_example');
function my_phpmailer_example ($phpmailer) {
$phpmailer-> From = SMTP_FROM;
//My new definition.
$phpmailer->addReplyTo('[email protected] ',' Information ');
...
}
I want to set the SMTP settings manually instead of using a plugin. I did this using this resource. However, there is a problem. If the user clicks "Reply", a different e-mail appears. Probably I've described this before with the plugin. However, I cannot remove it. If I make a new definition as below, it creates a new reply e-mail. Therefore, the past is not erased. What I want: If the user clicks to reply to the incoming e-mail, only smtp_from e-mail should appear.
My Codes:
wp-config.php
define ('SMTP_FROM', '[email protected]');
...
function.php
add_action ('phpmailer_init', 'my_phpmailer_example');
function my_phpmailer_example ($phpmailer) {
$phpmailer-> From = SMTP_FROM;
//My new definition.
$phpmailer->addReplyTo('[email protected] ',' Information ');
...
}
Share
Improve this question
edited Jun 7, 2021 at 19:29
asked May 28, 2021 at 12:53
user205760user205760
2
|
1 Answer
Reset to default 1Depending on your setup and other specifics to your use case, you may want to clear any previous reply addresses. You can do this with $phpMailer->ClearReplyTos()
. For example:
add_action ('phpmailer_init', 'my_phpmailer_example');
function my_phpmailer_example ($phpmailer) {
$phpmailer->ClearReplyTos();
$phpmailer->addReplyTo('[email protected]', 'EXAMPLE');
}
Also, if your example code in your question is exactly what you're using, you need to be careful of a few things:
- Make sure your variables are right. For example, the argument in your function is
$ phpmailer
<-note the space If you have it like that, that could be the source of your problem. Fix the space (i.e.$phpmailer
) - The line for your
$phpmailer->AddReplyTo()
is commented out. Is that intentional? With the comment ("//"), that line will not doing anything.
本文标签: wp mailHow Can I Change Default Reply ToEmail
版权声明:本文标题:wp mail - How Can I Change Default Reply ToEmail 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741512510a2382688.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
wp_mail_from
hook instead. – Sally CJ Commented May 29, 2021 at 5:14