Attach a file to a quick mailer:
$swift =& new Swift(new Swift_Connection_SMTP(MAIL_SMTP_URL, MAIL_SMTP_PORT)); $message =& new Swift_Message($subject); $recpients =& new Swift_RecipientList(); $sender =& new Swift_Address(' info@example.com ', 'example.com'); $recpients->addTo(' info@example.com ', 'www.example.com'); $message->attach(new Swift_Message_Part('this is my body')); $message->attach(new Swift_Message_Attachment($binarycontents, $fileTitle, $mimeType)); $swift->send($message, $recpients, $sender);
in your case the attachment will be:
$message->attach(new Swift_Message_Attachment(file_get_contents($file), $order.'order.csv', 'application/vnd.ms-excel'));
for example, for example :)
source share