I'm using swiftmailer. Everything works fine. But if I add an attachment like this:
->attach(Swift_Attachment::fromPath('/images/products/' . $attachName))
I've an error: Attempted to load class "Swift_Attachment"
Any idea?
Possible duplicate of Conditional attachment of file using swiftmailer and symfony2
Seems to be a namespacing problem, check how you called Swift_Message and try ->attach(\Swift_Attachment::fromPath('/images/products/' . $attachName))