PHP forums, MySQL forums, Web Development resources

Home PageHome    PHP ResourcesTopic List    FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups 
 RegisterRegister
    ProfileProfile    Log in to check your private messagesLog in to check your private messages    Download the RSS Reader RSS Feed Download the RSS Reader RSS for this forum Log inLog in 

PHP Forum :: MySQL Forum :: Java Script Forum



Pear send HTML problem

 
Post new topic   Reply to topic    WeberForums.com Forum Index -> PEAR
View previous topic :: View next topic  
Author Message
Joseph



Joined: 13 Dec 2008
Posts: 1

PostPosted: Sat Dec 13, 2008 5:16 pm    Post subject: Pear send HTML problem Reply with quote

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
View user's profile Send private message
lostboy



Joined: 02 May 2004
Posts: 6033
Location: toronto, canada

PostPosted: Tue May 05, 2009 3:13 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address MSN Messenger
ganpil



Joined: 29 Jan 2010
Posts: 1

PostPosted: Fri Jan 29, 2010 6:01 am    Post subject: clear my doubt. Reply with quote

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
View user's profile Send private message
vipin kumar



Joined: 05 Apr 2010
Posts: 26

PostPosted: Fri Jun 04, 2010 4:59 pm    Post subject: Re: clear my doubt. Reply with quote

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
View user's profile Send private message
danieljeanz



Joined: 27 Apr 2010
Posts: 3

PostPosted: Mon Jun 28, 2010 2:57 pm    Post subject: Reply with quote

Thanks for sharing with us
Back to top
View user's profile Send private message
Display posts from previous:   
WeberTrivia Questions WeberTrivia Questions
 Think you are smart? Prove it!. Try your skills with these questions :
 WeberTrivia QuestionsRecursive arrays and multi-dimensional arrays are one and the same. (PHP and MySQL)
 WeberTrivia QuestionsThe \"cache_dir\" tag of the squid configuration has a default of /var/spool/squid. (Linux)

WeberTrivia Questions



PHP Code Examples
 Stream diffrent sizes of images from a single image to save disk space.
 JavaScript dropdown list menu to switch any page.
 Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
 PHP Dump in html format the contents of one array variable with a recursive list of the nested array variables inside.
 Link Extractor - This function is used to extract links from a given URL. This will convert relative path into absolute path and also remove PHPSESSID stuff.
 Building a Dynamic Form using Javascript and innerHTML. Add form elements in realtime without refreshing the page.
 A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function.
Post new topic   Reply to topic    WeberForums.com Forum Index -> PEAR All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
PHP Forum :: MySQL Forum :: Java Script Forum