-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathotp_function.php
More file actions
30 lines (26 loc) · 819 Bytes
/
otp_function.php
File metadata and controls
30 lines (26 loc) · 819 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
29
30
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require 'phpmailer/vendor/autoload.php';
function send_otp($email,$otp){
// Load Composer's autoloader
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->SMTPDebug = 0;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->Host = "smtp.gmail.com";
$mail->Username = "project.iwp2020@gmail.com";
$mail->Password = "IWP20202020";
$mail->isHTML(true);
$mail->AddAddress($email);
$mail->SetFrom("project.iwp2020@gmail.com", "ABC registration");
$mail->Subject = "OTP verification";
$content = "<b>Welcome to the ABC family<br>Your otp for verification is: ".$otp."</b>";
$mail->MsgHTML($content);
$mail->Send();
}
?>