phpmailer: Reply using only "Reply To" address
To send an email using PHPMailer and have the reply go only to the "Reply-To" address, you can set the "addReplyTo" method and pass in the email address you want the reply to go to. For example:
$mail->addReplyTo('[email protected]', 'Name');
Watch a video course
Learn object oriented PHP
You can also set the reply-to address using the $mail->setFrom()
method, which accepts three parameters, email, name and auto-reply-to, like so:
$mail->setFrom('[email protected]', 'Name', true);
The last parameter, auto-reply-to, is set to true by default, so you can skip it if you want to use the same address for the reply-to and from fields.