Php 使用Swiftmailer的多个附件
我正在创建一个允许上传多个文件的表单。然后将表单字段值和附件通过电子邮件发送到特定地址。我正在使用Swiftmailer生成这些电子邮件。我知道如何使用Swiftmailer附加文件,但我不知道如何附加多个文件。有人知道使用Swiftmailer是否可以做到这一点吗?是的,只需多次调用Php 使用Swiftmailer的多个附件,php,email,swiftmailer,Php,Email,Swiftmailer,我正在创建一个允许上传多个文件的表单。然后将表单字段值和附件通过电子邮件发送到特定地址。我正在使用Swiftmailer生成这些电子邮件。我知道如何使用Swiftmailer附加文件,但我不知道如何附加多个文件。有人知道使用Swiftmailer是否可以做到这一点吗?是的,只需多次调用attach(): 来源:若要为附件提供替代文件名,您可以使用:$message->attach(Swift\u attachment::fromPath($filepath)->setFilename($mypr
attach()
:
来源:若要为附件提供替代文件名,您可以使用:
$message->attach(Swift\u attachment::fromPath($filepath)->setFilename($mypreferredfilename))
$message->attach(Swift_Attachment::fromPath('../../uploads/hocuradit/' . $attPath . $attA));
$message->attach(Swift_Attachment::fromPath('../../uploads/hocuradit/' . $attPath . $attB));