Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.
Moderators: Chris Corbyn , General Moderators
hergy80
Forum Newbie
Posts: 2 Joined: Fri Jun 01, 2007 11:31 am
Post
by hergy80 » Fri Jun 01, 2007 11:34 am
When we try to embed an image into an html doc we keep getting a MimeException:
Cannot set attribute 'name' for header 'Content-Type' as the header does not exist.
A snippit of our code is:
Code: Select all
$message = new Swift_Message($msg->Subject);
...
$EmbeddedFile = new Swift_Message_EmbeddedFile($attachInfo['Data'], $attachInfo['Name'], $attachInfo['Type'], $attachInfo['CID']);
$src = $message->attach($EmbeddedFile);
We're using the latest build on the download page. Any help would be appreciated!
Thanks.
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Fri Jun 01, 2007 2:33 pm
Hmm, what does this show:
Code: Select all
echo "Data length is: " . strlen($attachInfo["Data"]) . "<br />";
echo "Name contains:";
var_dump($attachInfo["Name"]);
echo "Type contains:";
var_dump($attachInfo["Type"]);
echo "CID conains:";
var_dump($attachInfo["CID"]);
$EmbeddedFile = new Swift_Message_EmbeddedFile($attachInfo['Data'], $attachInfo['Name'], $attachInfo['Type'], $attachInfo['CID']);
It's almost like NULL is being passed for the Type parameter (which would basically be 'undefined index "Type"' if error reporting was set to show notices).
hergy80
Forum Newbie
Posts: 2 Joined: Fri Jun 01, 2007 11:31 am
Post
by hergy80 » Fri Jun 01, 2007 3:27 pm
Your were right. The $attachInfo is populated from a class' array that didn't have the keys setup properly. Thanks for your quick response and I must say I'm very impressed with Swift Mailer thus far!