Php 使用Swiftmailer时如何设置回复

Php 使用Swiftmailer时如何设置回复,php,email,swiftmailer,Php,Email,Swiftmailer,使用Swiftmailer时如何设置回复。文档中提到了函数setReplyTo(),但没有具体说明如何使用它 任何帮助都将不胜感激。我可以确认setReplyTo方法的工作方式与(例如)该方法相同 对于那些经历过与我相同困惑的人,您无法在Swift\u收件人列表上运行$recipients->setReplyTo(),但您可以直接在Swift\u邮件上运行: $recipients = new Swift_RecipientList; // this is correct $recipients

使用Swiftmailer时如何设置回复。文档中提到了函数setReplyTo(),但没有具体说明如何使用它


任何帮助都将不胜感激。

我可以确认
setReplyTo
方法的工作方式与(例如)该方法相同


对于那些经历过与我相同困惑的人,您无法在Swift\u收件人列表上运行
$recipients->setReplyTo()
,但您可以直接在Swift\u邮件上运行:

$recipients = new Swift_RecipientList;
// this is correct
$recipients->addTo('some@email.com');
// this method does not exist so this does not work
$recipients->addReplyTo('some.other@email.com');

$message = new Swift_Message($subject, $message, 'text/html');
// you can, however, add the reply-to here like this
$message->setReplyTo('some.other@email.com');
// and of course sending the e-mail like this with the reply to works
$swift->send($message, $recipients, 'some@email.com');

它需要文档中指定的地址:-应与返回路径类似:
$recipients = new Swift_RecipientList;
// this is correct
$recipients->addTo('some@email.com');
// this method does not exist so this does not work
$recipients->addReplyTo('some.other@email.com');

$message = new Swift_Message($subject, $message, 'text/html');
// you can, however, add the reply-to here like this
$message->setReplyTo('some.other@email.com');
// and of course sending the e-mail like this with the reply to works
$swift->send($message, $recipients, 'some@email.com');