You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 17, 2021. It is now read-only.
setSubject('See my image');
$msg -> setFrom(array('swift@example.com'));
$msg -> setTo(array('thunderbird@example.com'=>'Thunderbird Client'));
$msg -> setBody("This is the plain text you'll see when I try and embed an image.");
//Image to embed
$cid = $msg->embed(Swift_Image::fromPath('logo.png'));
$img = '
';
// HTML body
$msg -> addPart(
"
See my logo
" .
"
Outlook works, Thunderbird will fall back to plain text and show the " .
"HTML body (as Part 1.2) and the image as attachments
" .
$img,
```
'text/html'
```
);
//Transport and Mailer
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
if($mailer->send($msg)) {
echo "Message Sent";
}
@@@
Creates a structure similar to the following:
@@@
Content-Type: multipart/related; boundary="relbound"
--relbound
Content-Type: text/plain
Plain text here
--relbound
Content-Type: text/html
HTML here
--relbound
Content-Type: image/png
--relbound--
@@@
There should be a multipart/alternative entity wrapping this:
@@@
Content-Type: multipart/alternative; boundary="altbound"
--altbound
Content-Type: text/plain
Plain text here
--altbound
Content-Type: multipart/related; boundary="relbound"
--relbound
Content-Type: text/html
HTML here
--relbound
Content-Type: image/png
--relbound--
--altbound--
@@@
Probably a simple fix (I seem to remember fixing a similar bug which should have test coverage now). Hopefully there's no conflict of logic between the two.
Original creation date: 2009-03-23T09:06:36Z
Original reporter: Ben
Original ticket: http://swiftmailer.lighthouseapp.com/projects/21527/tickets/77