Multiple Attachments with Swiftmailer

◇◆丶佛笑我妖孽 提交于 2019-12-08 15:13:39

问题


I'm creating a form that allows multiple files to be uploaded. The form field values and attachments are then to be emailed to certain address. I'm using Swiftmailer to generate these emails. I know how to attach a file with Swiftmailer, but I don't know how to attach multiple files. Does anybody know whether this is possible using Swiftmailer?


回答1:


Yes, it's simply a matter of making multiple calls to 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



来源:https://stackoverflow.com/questions/6118428/multiple-attachments-with-swiftmailer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!