Send E-Mail From localhost in php


To send the E-mail from your local host. Download the PHPMailer in the Right Side My Share Box and use following function

include ‘PHPMailer/class.phpmailer.php’;

function Mailer($to,$body,$subject)
{
try {
$mail    = new PHPMailer(true);
$body  .= $temp;
$body    = preg_replace(‘/\\\\/’,”, $body);
$mail->IsSMTP();
$mail->SMTPAuth       = true;
$mail->Port           = 25;
$mail->Host           = “mailgoogle.com”;
$mail->Username       = “testt@gmail.com”;
$mail->Password       = “#h#123”;
$mail->AddReplyTo(“yourmail@gmail.com”,”Karuppasamy”);
$mail->From           = “p.karuppasamy@gmail.com.com”;
$mail->FromName       = “Karuppasamy Mail”;
$mail->AddAddress($to);
$mail->Subject        =$subject;
$mail->AltBody      = “To view the message, please use an HTML compatible email viewer!”;
$mail->WordWrap       = 80;
$mail->MsgHTML($body);
$mail->IsHTML(true);
$mail->Send();
return true;
} catch (phpmailerException $e) {
return $e->errorMessage();
}
}

By karuppasamy11486 Posted in Uncategorized

Leave a comment