-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend_the_email.php
35 lines (28 loc) · 1.52 KB
/
send_the_email.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
<?php
require 'vendor/phpmailer/phpmailer/PHPMailerAutoload.php';
$email_one = $_POST["email_one"];
$email_two = $_POST["email_two"];
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.sendgrid.net'; // Specify main/backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username =''; // SMTP username -- !!!!! VERY IMPORTANT
$mail->Password = ''; // SMTP password -- !!!!! VERY IMPORTANT
$mail->SMTPSecure = 'tls'; // Enable TLS/SSL encryption
$mail->Port = 587; // TCP port to connect to
$mail->From = 'ghost@league_table.scm.azurewebsites.net';
$mail->FromName = 'League Table';
$mail->addAddress($email_one, 'Player One'); // Add a recipient
$mail->addAddress($email_two, 'Player Two'); // Add a recipient
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'League Table - Fixture Reminder';
$mail->Body = $_POST["message"] . "<p><a href=\"http://willsblogjsleague.azurewebsites.net\">See website here</a></p>";
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>