Problem Emailing HTML

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
gamak
Forum Newbie
Posts: 8
Joined: Tue Feb 10, 2009 7:24 pm

Problem Emailing HTML

Post by gamak »

Hello

I'm having a problem emailing HTML content. I'm getting message data from a PHP form. When ever the stuff is sent through email, it doesnt display in HTML, but instead shows all the HTML tags in the email, Like below.

<P>Hi <<FIRST Name>>,<BR><BR>Hey <STRONG>boss</STRONG> what have you <FONT face="Comic Sans MS" size=3>been</FONT> up to? &nbsp;</P>


Any ideas?

Code: Select all

 
$swift =& new Swift(new Swift_Connection_SMTP("localhost"));
                    $message =& new Swift_Message("$temp_sub");
                    $message->attach(new Swift_Message_Part($tmp_msg));
                    $message->attach(new Swift_Message_Part("$tmp_msg", "text/html"));
                    $email_address = $_SESSION['email_array'][$_SESSION['email_count']][$i]; 
                     
                    if ($swift->send($message, new Swift_Address($email_address, $temp_sub), new Swift_Address($temp_from)))                    
                    {
 
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Problem Emailing HTML

Post by Chris Corbyn »

It looks like you're adding the same content to the HTML and plain text parts. Does $tmp_msg contain HTML?

The plain text part must contain plain text.
Post Reply