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();
}
}

Advertisements
By karuppasamy11486 Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s