Paulo Coghi
Paulo Coghi

Reputation: 14959

Headers and MIME types for HTML email messages (sending through PHP)

What is the correct header information and MIME types for an email message with HTML content only, not mixed type (with both text and HTML).

Just to inform, I am using Swiftmailer (PHP) to this job.

Upvotes: 0

Views: 1269

Answers (1)

joar
joar

Reputation: 15897

This is my code:

$swift = new stdClass();
$swift->transport = Swift_SendmailTransport::newInstance( '/usr/sbin/sendmail -bs' );
$swift->mailer = Swift_Mailer::newInstance( $swift->transport );
$swift->message = Swift_Message::newInstance('Title')
    ->setFrom( array('[email protected]' => 'Me') )
    ->setTo( array( '[email protected]' => 'Some One' ) )
    ->setBody('<h1>It works!</h1>', 'text/html');

You can also take a look at the Headers documentation on http://swiftmailer.org/docs/headers

Upvotes: 1

Related Questions