Appearance
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:
Example of setting the "addReplyTo" method to send an email using PHPMailer and have the reply go only to the "Reply-To" address in PHP
php
$mail->addReplyTo('[email protected]', 'Name');
<div class="alert alert-info flex not-prose">Watch a video course Learn object oriented PHP
</div>
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:
Example of using $mail->setFrom method to send an email using PHPMailer and have the reply go only to the "Reply-To" address in PHP
php
$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.