-
Notifications
You must be signed in to change notification settings - Fork 1
/
Mail.php
39 lines (35 loc) · 1.29 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
39
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
class Mail
{
public $mail;
public function __construct()
{
$this->mail = new PHPMailer;
$this->mail->isSMTP();
$this->mail->Host = 'ssl://smtp.gmail.com';
$this->mail->SMTPAuth = true;
$this->mail->Username = 'kandpalpankaj08@gmail.com';
$this->mail->Password = '8449973829';
$this->mail->SMTPSecure = 'ssl';
$this->mail->Port = 465;
}
public function sendMail($lastID, $hash)
{
$this->mail->setFrom('kandpalpankaj08@gmail.com', 'E_library');
$this->mail->addAddress($_POST['email']);
$this->mail->Subject = "Verification link";
$this->mail->isHTML(true);
$this->mail->SMTPDebug = 0;
$this->base_url = "http://3.6.32.116/activation?hash=${hash}&id={$lastID}";
$this->mailContent = 'Hi, <br/> <br/> verification is required for your email address before we migrate to the application.
<br/> <br/> <a href ="'.$this->base_url.'">Click here to verify.</a>
' ;
$this->mail->Body = $this->mailContent;
if (!$this->mail->send()) {
echo 'Message could not be sent';
echo 'Mailer Error: ' . $this->mail->ErrorInfo;
}
}
}