-
Notifications
You must be signed in to change notification settings - Fork 0
/
mail.php
38 lines (34 loc) · 1.41 KB
/
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
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require "PHPmailer/src/PHPMailer.php";
require "PHPmailer/src/Exception.php";
require "PHPmailer/src/SMTP.php";
function sendMail($fullName,$account,$email,$secondemail,$thirdemail,$html){
$mail = new PHPMailer(true);
try {
$mail->CharSet="UTF-8";
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'magnetite';
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
//Recipients
$mail->setFrom('[email protected]', ' NO REPLY - IES Reservations');
$mail->addAddress($email); // Add a recipient
$mail->addAddress($secondemail); // Add another recipient
if(!empty($thirdemail)){
$mail->addAddress($thirdemail);
}
//Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'IES Reservations -- NO REPLY';
$mail->Body = $html;
$mail->send();
echo ( 'sent');
} catch (Exception $e) {
return json_encode ('error');
}
}