-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail.php
36 lines (33 loc) · 1.13 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
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'path/to/PHPMailer/src/Exception.php';
require 'path/to/PHPMailer/src/PHPMailer.php';
require 'path/to/PHPMailer/src/SMTP.php';
function send_mail($to,$subject,$message){
$mail = new PHPMailer(true);
try {
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = 'Nr.Travel.com';
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "travel0p455w0rd";
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->setFrom("[email protected]", "NR-Naushad");
$mail->addAddress($to);
$mail->addReplyTo("[email protected]","NR-Naushad");
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AltBody = $message;
$mail->send();
//echo 'Message has been sent';
} catch (Exception $e) {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
return 0;
}
return 1;
}
?>