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
try{
$decorator = new Swift_Plugins_DecoratorPlugin($replacement);
$this->mailer->registerPlugin($decorator);
$this->message->setTo($userEmailAddress)->setBody($themessage);
echo $this->mailer->send($this->message);
} catch (Exception $ex)
{
//will figure out something about this part
$ex->getMessage();
echo "Error sending the message";
}