32

How can reply-to be set when using Swiftmailer. The docs mentioned the function setReplyTo() but without specific instructions on how to use it.

Any help will be appreciated.

1

2 Answers 2

52

I can confirm that the setReplyTo method works the same way as (for example) the setCC method.

$message->setReplyTo(array( '[email protected]', '[email protected]' => 'Person 2 Name', '[email protected]', '[email protected]', '[email protected]' => 'Person 5 Name' )); 
Sign up to request clarification or add additional context in comments.

Comments

1

For those who experienced the same confusion as me, you are not able to run $recipients->setReplyTo() on a Swift_RecipientList but you are able to do so on the Swift_Message directly:

$recipients = new Swift_RecipientList; // this is correct $recipients->addTo('[email protected]'); // this method does not exist so this does not work $recipients->addReplyTo('[email protected]'); $message = new Swift_Message($subject, $message, 'text/html'); // you can, however, add the reply-to here like this $message->setReplyTo('[email protected]'); // and of course sending the e-mail like this with the reply to works $swift->send($message, $recipients, '[email protected]'); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.