Skip to content
This repository was archived by the owner on Nov 17, 2021. It is now read-only.
/ swiftmailer Public archive
This repository was archived by the owner on Nov 17, 2021. It is now read-only.

setBody() + addPart() with embedded images doesn't correctly add multipart/alternative entity #56

@ghost

Description

The following code:

@@@ php

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 = '

Awesome Logo

'; // 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions