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', '<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8eebf6efe3fee2ebceebf6efe3fee2eba0ede1e3">[email protected]</a>');
...
function.php
add_action ('phpmailer_init', 'my_phpmailer_example');
function my_phpmailer_example ($phpmailer) {
$phpmailer-> From = SMTP_FROM;
//My new definition.
$phpmailer->addReplyTo('<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="610419000c110d04210419000c110d044f020e0c">[email protected]</a> ',' Information ');
...
}
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Depending 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('<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="83e6fbe2eef3efe6c3e6fbe2eef3efe6ade0ecee">[email protected]</a>', '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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0