Как установить ответ на использование Swiftmailer
Как настроить ответ при использовании Swiftmailer. В документах указана функция setReplyTo(), но без конкретных инструкций по ее использованию.
Любая помощь будет оценена.
Ответы
Ответ 1
Я могу подтвердить, что метод setReplyTo
работает так же, как (например) метод setCC.
$message->setReplyTo(array(
'[email protected]',
'[email protected]' => 'Person 2 Name',
'[email protected]',
'[email protected]',
'[email protected]' => 'Person 5 Name'
));
Ответ 2
Для тех, кто испытал ту же растерянность, что и я, вы; вы не можете запустить $recipients->setReplyTo()
для Swift_RecipientList, но вы можете сделать это непосредственно для Swift_Message:
$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]');