bradkenyon Posted September 16, 2008 Share Posted September 16, 2008 I am using a script, that uses a pear library, I use to use the html mime mail library which did a great job w/ html email I am wondering how I could set this email msg to be in html. <?php require_once "Mail.php"; $from = "email@domain.edu"; $to = "receiver@ domain.edu"; $subject = "Hi!"; $body = "<p>Hi, How are you?</p>"; $host = "mail1.domain.edu"; $username = "user"; $password = "pass"; $headers = array ('From' => $from, 'To' => $to, 'X-From-Web' => $from, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if(PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> The email msg I receive, has the <p></p> tags in it. Quote Link to comment https://forums.phpfreaks.com/topic/124510-php-mail-in-html-mail/ Share on other sites More sharing options...
kodosai Posted September 16, 2008 Share Posted September 16, 2008 I am using a script, that uses a pear library, I use to use the html mime mail library which did a great job w/ html email I am wondering how I could set this email msg to be in html. <?php require_once "Mail.php"; $from = "email@domain.edu"; $to = "receiver@ domain.edu"; $subject = "Hi!"; $body = "<p>Hi, How are you?</p>"; $host = "mail1.domain.edu"; $username = "user"; $password = "pass"; $headers = array ('From' => $from, 'To' => $to, 'X-From-Web' => $from, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if(PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> The email msg I receive, has the <p></p> tags in it. add this in your headers... 'MIME-Version: 1.0' . "\r\n"; 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; Quote Link to comment https://forums.phpfreaks.com/topic/124510-php-mail-in-html-mail/#findComment-643047 Share on other sites More sharing options...
bradkenyon Posted September 16, 2008 Author Share Posted September 16, 2008 thank you! Quote Link to comment https://forums.phpfreaks.com/topic/124510-php-mail-in-html-mail/#findComment-643059 Share on other sites More sharing options...
openbox Posted September 19, 2008 Share Posted September 19, 2008 can you teach me how to use this code? im only new in php... thanks! Quote Link to comment https://forums.phpfreaks.com/topic/124510-php-mail-in-html-mail/#findComment-645623 Share on other sites More sharing options...
xsist10 Posted September 22, 2008 Share Posted September 22, 2008 I recommend reading this: http://www.hudzilla.org/phpbook/read.php/15_5_3 You want to use this command <?php include('Mail.php'); include('Mail\mime.php'); $message = new Mail_mime(); $html = "<p>Hey</p>"; $message->setHTMLBody($html); $body = $message->get(); $extraheaders = array("From"=>"me@example.com", "Subject"=>"My Subject 7"); $headers = $message->headers($extraheaders); $mail = Mail::factory("mail"); $mail->send("bob@bob.com", $headers, $body); ?> Quote Link to comment https://forums.phpfreaks.com/topic/124510-php-mail-in-html-mail/#findComment-647669 Share on other sites More sharing options...
bradkenyon Posted September 22, 2008 Author Share Posted September 22, 2008 thank you! Quote Link to comment https://forums.phpfreaks.com/topic/124510-php-mail-in-html-mail/#findComment-647673 Share on other sites More sharing options...
djbuddhi Posted October 22, 2008 Share Posted October 22, 2008 use phpemailler class .it works very well abd u can download it on source forge.net Quote Link to comment https://forums.phpfreaks.com/topic/124510-php-mail-in-html-mail/#findComment-671512 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.