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('[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.