| View previous topic :: View next topic |
| Author |
Message |
Joseph
Joined: 13 Dec 2008 Posts: 1
|
Posted: Sat Dec 13, 2008 5:16 pm Post subject: Pear send HTML problem |
|
|
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>");
}
?> |
|
| Back to top |
|
 |
lostboy

Joined: 02 May 2004 Posts: 6033 Location: toronto, canada
|
Posted: Tue May 05, 2009 3:13 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
ganpil
Joined: 29 Jan 2010 Posts: 1
|
Posted: Fri Jan 29, 2010 6:01 am Post subject: clear my doubt. |
|
|
| I don't know how the pear will create problem and i finished all the content of the post. But i can't understand. Can anyone describe me as briefly. |
|
| Back to top |
|
 |
vipin kumar
Joined: 05 Apr 2010 Posts: 26
|
Posted: Fri Jun 04, 2010 4:59 pm Post subject: Re: clear my doubt. |
|
|
| ganpil wrote: | | I don't know how the pear will create problem and i finished all the content of the post. But i can't understand. Can anyone describe me as briefly. |
i am aslo like him but u can search on this forum . |
|
| Back to top |
|
 |
danieljeanz
Joined: 27 Apr 2010 Posts: 3
|
Posted: Mon Jun 28, 2010 2:57 pm Post subject: |
|
|
| Thanks for sharing with us |
|
| Back to top |
|
 |
|