It is currently Wed Feb 08, 2012 5:29 pm

All times are UTC + 2 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Pear send HTML problem
PostPosted: Sat Dec 13, 2008 6:16 pm 
Offline

Joined: Sat Dec 13, 2008 6:13 pm
Posts: 1
When using the following code the plain text & HTML that are stored in files are sent, BUT the HTML appears as HTML code (like you would see in "view source") rather than as the HTML page that I am trying to send.

Can anyone show me what I'm doing wrong, or provide a better way?

Thanks!

<?
include('Mail.php');
include('Mail/mime.php');
// Get the plain text & HTML from files
$message = new Mail_mime();
$text = file_get_contents("mail_text.txt");
$html = file_get_contents("mail_html.html");
$message->setTXTBody($text);
$message->setHTMLBody($html);
$mailmsg = $message->get();
// Set the headers
$recipients = "gmailuser@gmail.com";
$headers["From"] = "me@mymail.org";
$headers["To"] = "gmailuser" ;
$headers["Subject"] = "User feedback";
$smtpinfo["host"] = "mail.mymail.org";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["debug"] = false;
$smtpinfo["username"] = "user";
$smtpinfo["password"] = "password";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);

if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}

?>


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 05, 2009 4:13 pm 
Offline

Joined: Sun May 02, 2004 11:34 pm
Posts: 6500
Location: toronto, canada
could it be that the html < > symbols are coming in the form of the ascii equivalents ( & gt; & lt;)?

Try running a replace on all the symbols to replace them with the correct ones

_________________
Lostboy

Cat, the other other white meat

Please read Posting Etiquette before posting

You can always try Google


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 2 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to: