Search in This Blog

mail using PHPMailer

How to send using PHPMailer


PHPMailer is the good option to send email in PHP. To use PHPMailer first download it from

extract and paste entire folder. paste below code:

public function sendEMail($tto, $fFrom, $sSubject, $bBody) {
$html_message = $bBody;
$mail = new PHPMailer();
                $mail->Host = '';// set here your mail server
                // set user and pass of your email if authentication required.
                $mail->Username     = 'user';
                $mail->Password     = 'pass';
$mail->From = $fFrom;
$mail->FromName = "Test".' '."Mail"; //name
$mail->Subject = $sSubject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mailAns = $mail->Send();
return $mailAns;
sendEMail("toemail", "fromemail", "subject", "email msg body")