[FLOW3-general] Swift Mailer Attachment

"Christian Müller (Kitsunet)" christian.mueller at typo3.org
Tue Sep 27 10:43:20 CEST 2011


Hi Markus,

only a few classes of SwiftMailer are extended for the package (one 
example being \TYPO3\SwiftMailer\Message) but not all of them.

The Swift_Attachment is not extended so it has no namespaces as 
SwiftMailer doesn't use it. So \Swift_Attachment::fromPath should do the 
trick.

cheers,
Christian

On 27/09/11 10:30, Markus Goldbeck wrote:
> Hello everybody,
>
> I have some Problem to attach an attachment to my SwiftMailer Objekt.
> Swift_attachment is not found but I can't understand why.
>
> $mail = new \TYPO3\SwiftMailer\Message();
>
>
> $mail ->setFrom(array('bla at bla.de' => 'some Guy from'))
> ->setTo(array('to at to.de' => 'foo'))
> ->setSubject('Mail Subject')
> ->setBody("some content")
> ->attach(\TYPO3\SwiftMailer\Swift_Attachment::fromPath($filepath))
> ->send();
>
> Another path I tried was \TYPO3\Swift_Attachment::
>
>
> error Message:
> PHP Fatal error: Class 'TYPO3\\SwiftMailer\\Swift_Attachment' not found
> in /var/www/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classe
>
>
> Any hint is very welcome.
>
> Best Regards,
>
> Markus



More information about the FLOW3-general mailing list