sending a multipart mail with html template in version 4.0.4

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

Post Reply
User avatar
Forum Contributor
Posts: 118
Joined: Tue Oct 24, 2006 1:07 pm

sending a multipart mail with html template in version 4.0.4

Post by highjo »

Hello good fellas
I'm trying to send a multipart email with the html part from an html template.
i've successfully used the decorator plugin to send plain text mail.
1 from the documentation on the version 3 there is the Swift_File class that can do the job.It's seems not present here, where is it's successor?
how to add the html part which is a file?
2 the second problem arise where i have images in that template.So i believe that template should be a php file.Then should i create another Swift_Message object in there to be able to use the embed property?

3. need some proper way to handle exceptions
here is part of my code.

Code: Select all

//this is inside my function sendMessage() with plenty argument for the $replacement variable $themessage is the text with placeholder to be sent
//mailer, message and transport object are set in the constructor
$decorator = new Swift_Plugins_DecoratorPlugin($replacement);
        echo $this->mailer->send($this->message);
        } catch (Exception $ex)
                       //will figure out something about this part
            echo "Error sending the message";
so fellas that's about it how will you do that ?Please let me know what you think, and thanks for reading
Post Reply