Page 1 of 1

Adding MIME headers to emails sent using Swift Mailer

Posted: Mon May 18, 2009 5:07 pm
by Sephirangel
Hello all,

I have the following mail script;

Code: Select all

<?php
        
        require_once('SwiftMailer/lib/swift_required.php');
        
        $transport = Swift_SmtpTransport::newInstance('SMTP.blueyonder.co.uk', 25)
        ->setUsername('xxxxx')
        ->setPassword('xxxxx')
        ;
        
        $mailer = Swift_Mailer::newInstance($transport);
        
        
        $message = Swift_Message::newInstance('New Knitterbabes Sales')
        ->setFrom(array('xxxxxx' => 'xxxxx'))
        ->setTo(array('xxxxxxxx' => 'xxxxxx'))
        ->setBody("<b>TEST</b>")
        ;
        
        $result = $mailer->send($message)
?>
My question is; how do i specify the email type? e.g. text/html so any HTML within the message gets rendered in the email (such as the <b> tags in the message)

thanks in advance!

Re: Adding MIME headers to emails sent using Swift Mailer

Posted: Mon May 18, 2009 5:21 pm
by Benjamin
Please reference the documentation on the swiftmailer website. Specifically there is documentation on sending multipart messages.

Re: Adding MIME headers to emails sent using Swift Mailer

Posted: Mon May 18, 2009 6:00 pm
by Sephirangel
I have had a look through the SwiftMailer documentation but I am still unsure how to specify header type using the code I have used.

Re: Adding MIME headers to emails sent using Swift Mailer

Posted: Mon Jun 08, 2009 10:37 am
by aarffy
It's not all that clear where it is. I found it, but it took a while.

http://swiftmailer.org/docs/message-body