Hi list, I'm using Zend_Mail and trying to send an attachment. When I
attach something like so
$mail = new Zend_Mail();
$options = $config->mail->smtp->params->toArray();
$transport = new Zend_Mail_Transport_Smtp($config->mail->smtp->server,
$options);
$body = 'Attached are the results';
$mail->setFrom($config->mail->smtp->from, $config->mail->smtp->fromName);
$mail->addTo('[email protected]', 'Tim');
$mail->setSubject('a report');
$mail->setBodyText($body);
$output =
file_get_contents('tmp/report-1e9d3c4e-d56d-441a-8a8c-cb1d845281fb.zip');
$attachment = $mail->createAttachment($output);
$attachment->filename = 'report-1e9d3c4e-d56d-441a-8a8c-cb1d845281fb.zip';
$mail->send();
I receive an email with the following source
--_0274577fb16b6787ebdb9cd1d80dad60
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename"report-1e9d3c4e-d56d-441a-8a8c-cb1d845281fb.nessus"
PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxOZXNzdXNDbGllbnREYXRhPjxSZXBvcnQ+PFJlcG9y
dE5hbWU+TW9uLCAyMCBPY3QgMjAwOCAwOTozNDoxNCAtMDUwMDwvUmVwb3J0TmFt...
...
In particular, the line
Content-Disposition: attachment;
filename"report-1e9d3c4e-d56d-441a-8a8c-cb1d845281fb.zip"
Is there supposed to be an equals sign after that filename?
I can't view the email that was sent in thunderbird; the body text
isn't displayed and no zip attachment shows up. Also tried changing
the type of attachment to multipart/x-zip
Any help is appreciated. Using ZF 1.9.4
Thanks,
Tim