swiftmailer/swiftmailer — Issue #166: cant set custom boundary on nested parts
Author: mcauser
Created: 2012-02-19 13:41:08+00:00
State: open

When I try to set my own custom boundary it works fine until I attach a base64 encoded file (pdf).
When I attach the content type "multipart/alternative" is nested inside a "multipart/mixed" and I am unable to set the inner boundary to a custom value.

Shouldn't the nested boundary be the same as the parent boundary?

setSubject( "test subject" )
->setFrom( array( "mike@example.com" => "mike" ) )
->setTo( array( "mike@example.com" => "mike" ) )
->setBoundary( "this_is_sparta" )
;
$swiftMessage->setBody( "i am the html part", 'text/html', 'UTF-8' );
$swiftMessage->addPart( "i am the text part", 'text/plain', 'UTF-8' );
$swiftMessage->attach( Swift_Attachment::fromPath( "/var/www/test.pdf", 'application/pdf' ) );
echo $swiftMessage->toString();
?>

As demonstrated here:

Without attachment:
http://pastebin.com/0tMAKfWx

With attachment:
http://pastebin.com/LADUgsNC