Page 1 of 1

[SOLVED] Cannot set attribute 'name' error

Posted: Fri Jun 01, 2007 11:34 am
by hergy80
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.

Posted: Fri Jun 01, 2007 2:33 pm
by Chris Corbyn
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).

Posted: Fri Jun 01, 2007 3:27 pm
by hergy80
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!

Posted: Fri Jun 01, 2007 3:47 pm
by Chris Corbyn
8)