-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemailController2.php
79 lines (62 loc) · 1.92 KB
/
emailController2.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
require_once 'vendor/autoload.php';
require_once 'constant2.php';
// Create the Transport
$transport = (new Swift_SmtpTransport('smtp.gmail.com', 465, 'ssl'))
->setUsername(EMAIL)
->setPassword(PASSWORD);
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
function sendVerificationEmail($userEmail, $token)
{
global $mailer;
$body = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTD-8">
<title>Verify Email</title>
</head>
<body>
<div class="wrapper">
<p>
Thank you for signing up on our website. Please click on the link below to verify your email.
</p>
<a href="http://localhost/foodorderingsystem/ownerindex.php?token=' . $token .'">Verify your email address now</a>
</div>
</body>
</html>';
// Create a message
$message = (new Swift_Message('Please verify your email address'))
->setFrom(EMAIL)
->setTo($userEmail)
->setBody($body, 'text/html');
// Send the message
$result = $mailer->send($message);
}
function sendPasswordResetLink($userEmail, $token)
{
global $mailer;
$body = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTD-8">
<title>Verify Email</title>
</head>
<body>
<div class="wrapper">
<p>
Hello there,
Please click on the link below to reset your password.
</p>
<a href="http://localhost/foodorderingsystem/ownerindex.php?password-token=' . $token .'">Reset your password</a>
</div>
</body>
</html>';
// Create a message
$message = (new Swift_Message('Reset your password'))
->setFrom(EMAIL)
->setTo($userEmail)
->setBody($body, 'text/html');
// Send the message
$result = $mailer->send($message);
}