Hi ,
Am new in PEAR. I have using PEAR/Mail.php for sending mails using smtp authentication. Here that my mailto form.
[php]<?php
session_start();
ini_set("smtp_port",25);
include("Mail.php");
$name=$_POST["name"];
$email=$_POST["email"];
$phone=$_POST["phone"];
$company=$_POST["company"];
$message=$_POST["message"];
if( isset($_POST['security_code'])) {
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
//echo 'Thank you. Your message said "'.$_POST['message'].'"';
//Generate Mail
//================
// To send HTML mail, you can set the Content-type header.
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: xxxxxx";
$recipient="xxxxxxxx";
//subject
//========
$subject="Send Mail.";
//message
//=======
$message="
<table width=60% border=0 cellpadding=4 cellspacing=1 bgcolor=#cccccc>
<TR>
<TD colspan=2><font face=Arial size=2><b>Send Mail </b></font></td>
</tr>
<TR>
<TD bgcolor='#EFEFEF'><font face='Arial' size='2'>Name</font></td>
<TD bgcolor='#FFFFFF'><font face=Arial size=2>$name</font></td>
</tr>
<tr>
<td bgcolor='#EFEFEF'><font face='Arial' size='2'>Email ID</font></td>
<td bgcolor='#FFFFFF'><font face=Arial size=2>$email</font></td>
</tr>
<tr>
<td bgcolor='#EFEFEF'><font face='Arial' size='2'>Telephone</font></td>
<td bgcolor='#FFFFFF'><font face=Arial size=2>$phone</font></td>
</tr>
<tr>
<td bgcolor='#EFEFEF'><font face='Arial' size='2'>Company</font></td>
<td bgcolor='#FFFFFF'><font face=Arial size=2>$company</font></td>
</tr>
<tr>
<td bgcolor='#EFEFEF'><font face='Arial' size='2'>Comments / Messages</font></td>
<td bgcolor='#FFFFFF'><font face=Arial size=2>$message</font></td>
</tr>
</table>";
//SMTP process start=====================
$body=$message;
$smtp_obj=new Mail;
$from="xxxx@xx.x";
$host = "xxxx";
$username = "xxxx@xx.xx";
$password = "xxxx";
$to="xxx@xx.xx";
// $subject= mb_encode_mimeheader($subject,"UTF-8", "B", "\n");
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp_obj->send($to, $headers, $body);
if (!PEAR::isError($mail))
//echo("<p> Sorry, you have provided an invalid security code</p>");
$content= 'Our Representative will contact you soon. Thank you for contacting us.';
unset($_SESSION['security_code']);
} else {
//echo("<p>Message successfully sent!</p>");
$content= 'Sorry, you have provided an invalid security code<br><br>';
$content.= '<input type="button" value="Go back" onClick="history.back();">';
}
}
?>[/php]And am inlcude pear/mail.php
Using this i got mail...But html tags printed with our parsing..i think it print text mime type... How can i change into html