-
Notifications
You must be signed in to change notification settings - Fork 1
/
send_mail.php
59 lines (31 loc) · 1.34 KB
/
send_mail.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer/vendor/autoload.php';
$email = $_POST['email'];
$msg = $_POST['msg'];
$sub = $_POST['sub'];
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 0; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'blogieverify@gmail.com'; // SMTP firstname
$mail->Password = 'blogie2112'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;
// Passing `true` enables exceptions
$mail->setFrom('blogieverify@gmail.com');
$mail->addAddress($email);
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $sub;
$mail->Body = $msg;
$mail->send();
echo 1;
}
catch (Exception $e) {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
?>