使用 Swiftmailer 发送多个附件

2024-01-06

我正在创建一个允许上传多个文件的表单。然后将表单字段值和附件通过电子邮件发送到特定地址。我正在使用 Swiftmailer 生成这些电子邮件。我知道如何使用 Swiftmailer 附加一个文件,但不知道如何附加多个文件。有谁知道使用 Swiftmailer 是否可以实现这一点?


是的,只需多次调用即可attach():

$message->attach(Swift_Attachment::fromPath('../../uploads/hocuradit/' . $attPath . $attA)); 
$message->attach(Swift_Attachment::fromPath('../../uploads/hocuradit/' . $attPath . $attB)); 

Source: http://groups.google.com/group/swiftmailer/browse_thread/thread/416b287591dfe931?fwc=1 http://groups.google.com/group/swiftmailer/browse_thread/thread/416b287591dfe931?fwc=1

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Swiftmailer 发送多个附件 的相关文章