2016-07-27 5 views
-2

ファイルに電子メールを添付しようとしています。swiftmailer経由で添付文書を送信する

まず、pdfのsnappyBundle & &とliugioBundleを使用したxslファイルを使用してファイルを作成します。

すぐに私はそれを電子メールで添付ファイルとしてswiftmailerを使用して送信する必要があります。

提案がありますか?

答えて

0

はあなただけ使用することができます - あなたのSwitft_Mailerオブジェクト上>添付()メソッドを

http://swiftmailer.org/docs/messages.html

$email = \Swift_Message::newInstance() 
    ->setSubject('Subject') 
    ->setFrom('[email protected]') 
    ->setTo($recipients) 
    ->setBody(
     $this->renderView(
      'Emails/niceEmail.html.twig', 
      compact('foo', 'bar', 'message') 
     ), 
     'text/html' 
    ) 
    ->attach(Swift_Attachment::fromPath('my-document.pdf')); 
関連する問題