-
Notifications
You must be signed in to change notification settings - Fork 0
/
gmail-sample.php
24 lines (21 loc) · 947 Bytes
/
gmail-sample.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
// ---------- adjust these lines ---------------------------------------
$mail->Username = "[email protected]"; // your GMail user name
$mail->Password = "your-gmail-password";
$mail->AddAddress("[email protected]"); // recipients email
$mail->FromName = "your name"; // readable name
$mail->Subject = "Subject title";
$mail->Body = "Here is the message you want to send to your friend.";
//-----------------------------------------------------------------------
$mail->Host = "ssl://smtp.gmail.com"; // GMail
$mail->Port = 465;
$mail->IsSMTP(); // use SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->From = $mail->Username;
if(!$mail->Send())
echo "Mailer Error: " . $mail->ErrorInfo;
else
echo "Message has been sent";
?>