Translate

Friday 17 October 2014

Send Mail using PHPMailer Function

Explaination:

In his tutorial we can send Mail using PHP mailer function.For that first we will
download PHPMailer file and included in ur file where we want to send mail in that place.
Then in that message we want to daisplay the details from Database or statically you can
write your coding in u r message tag.By using this we can use i for to send any confirmatio
mail's to ur coustmer.I hope this tutorial is very useful for ur reference to send ur mail.



Mail Function:

$mail = new PHPMailer();
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled

$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465; // or 465
$mail->IsHTML(true);
$mail->Username = "Clientmail";
$mail->Password = "Clientpassword";
$mail->SetFrom("urmail"); 
$mail->FromName = 'Details';
$mail->AddAddress('urmailid');
$mail->Subject = "Give ur Subject";
$mail->Body = $message; 
$mail->IsHTML(true);
$mail->WordWrap = 50;
$done =  $mail->Send();
$mail->ClearAddresses();

PHP Coding:

Here error_reporting(0) is used to delete ur notice errror in ur file.In the username and password is 
to plaace  ur client mail-id and password they will give that you can mentioned there(ie)Email-id and Password for whose mail have to send ur details their mail;id have to given there.







<?php 
error_reporting(0);
include("connect.php");
include('PHPMailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled

$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465; // or 465
$mail->IsHTML(true);
$mail->Username = "Clientmail";
$mail->Password = "Clientpassword";
$mail->SetFrom("urmail"); 
$mail->FromName = 'Details';
if(isset($_POST['submit']))
{
$message='<html>
<table width="100%" border="1px solid " cellpadding="10" cellspacing="0" class="top_table">
<tr>
<th>Name</th>
<th>Email-ID</th>
<th>Contact Number</th>
</tr>
<tr>
<td>'.$name.'</td>
<td>'.$email_id.'</td>
<td>'.$mobileno.'</td>
</tr>
</table>
</html>';
}
$mail->AddAddress('urmailid');
$mail->Subject = "Give ur Subject";
$mail->Body = $message; 
$mail->IsHTML(true);
$mail->WordWrap = 50;
$done =  $mail->Send();
$mail->ClearAddresses();


Here error_reporting(0) is used to delete ur notice errror in ur file.In the username and password is 
to plaace  ur client mail-id and password they will give that you can mentioned there(ie)Email-id and
Password for whose mail have to send ur details their mail; id have to given there.

Download PHPMailer Function:CLICK HERE TO DOWNLOAD PHPMAILER FOLDER

No comments:

Post a Comment