For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Saturday, November 08, 2014

mail using PHPMailer

PROBLEM:
How to send using PHPMailer

SOLUTION:

PHPMailer is the good option to send email in PHP. To use PHPMailer first download it from
https://github.com/PHPMailer/PHPMailer

extract and paste entire folder. paste below code:

<?php
require_once('phpMailer/class.phpmailer.php');
public function sendEMail($tto, $fFrom, $sSubject, $bBody) {
$html_message = $bBody;
$mail = new PHPMailer();
                $mail->Host = 'mail.site.com';// 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!";
$mail->MsgHTML($html_message);
$mail->AddAddress($tto);
$mailAns = $mail->Send();
return $mailAns;
}
sendEMail("toemail", "fromemail", "subject", "email msg body")
?>
Share:

0 comments:

Post a Comment

How to make center align child div

 How to make center align child div?   Suppose you have 2 Div tag. And want the make inner tag center <div id="d1">      ...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive