-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail_function.php
More file actions
28 lines (27 loc) · 916 Bytes
/
Copy pathmail_function.php
File metadata and controls
28 lines (27 loc) · 916 Bytes
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
<?php
use PHPMailer\PHPMailer\PHPMailer;
require 'vendor/phpmailer/phpmailer/src/Exception.php';
require 'vendor/phpmailer/phpmailer/src/PHPMailer.php';
require 'vendor/phpmailer/phpmailer/src/SMTP.php';
function sendOTP($email,$otp) {
require('vendor/autoload.php');
$message_body = "One Time Password for PHP login authentication is:<br/><br/>" . $otp;
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = 'tls'; // tls or ssl
$mail->Port = 587;
$mail->Username = "xpensomail@gmail.com";
$mail->Password = "ovdngmavqafczicb";
$mail->Host = "smtp.gmail.com";
$mail->Mailer = "smtp";
$mail->setFrom("XpensoMail@gmail.com",'safespend-2');
$mail->AddAddress($email);
$mail->Subject = "OTP to Login to SafeSpend";
$mail->MsgHTML($message_body);
$mail->IsHTML(true);
$result = $mail->Send();
return $result;
}
?>