【问题标题】:Multiple Attachments with SwiftmailerSwiftmailer 的多个附件
【发布时间】:2011-09-01 09:13:11
【问题描述】:

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

【问题讨论】:

标签: php email swiftmailer


【解决方案1】:

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

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

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

【讨论】:

  • 要为附件提供替代文件名,您可以使用:$message->attach(Swift_Attachment::fromPath($filepath)->setFilename($mypreferredfilename))
猜你喜欢
  • 2014-08-23
  • 2012-01-28
  • 1970-01-01
  • 1970-01-01
  • 2016-12-01
  • 2014-08-06
  • 1970-01-01
  • 1970-01-01
  • 2013-10-08
相关资源
最近更新 更多