-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmtp.php
More file actions
31 lines (27 loc) · 1.04 KB
/
smtp.php
File metadata and controls
31 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
date_default_timezone_set('Etc/UTC');
require './PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->Port = 587; // SMTP port
$mail->Username = "amitarmittal@gmail.com"; // username
$mail->Password = "anshulrmittal"; // password
$mail->SetFrom('amitarmittal@gmail.com', 'Amit Mittal');
$mail->Subject = "SMTP";
$mail->Body ='Replay If Working';
$address = "amitarmittal@gmail.com";
$mail->AddAddress($address, "Test");
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message sent! to " . $address;
}