views:

14

answers:

1

Hi there!

I would like to send an auto-generated email with HTML body from my application using Swift.

Here is my current code:

$message = Swift_Message::newInstance()
                ->setFrom(array('[email protected]' => 'John Doe'))
                ->setTo('[email protected]')
                ->setSubject('some subject');

            $message->setBody($this->getPartial('global/mail_partial'));

            $this->getMailer()->send($message);

I had already tried to change the header Content-type of the email message using some specific Swift methods but it is not working.

can anyone give me some help?

Thanks in advance, Best regards!

+1  A: 

See:

Sending a HTML E-Mail (from SwiftMailer Docs)

You need to add this line to set html content-type:

$message->setContentType("text/html");
Sarfraz