-
Notifications
You must be signed in to change notification settings - Fork 0
/
mail_code.php
40 lines (33 loc) · 1.48 KB
/
mail_code.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
$message = '<html><head>
<title>Email Verification</title>
</head>
<body>';
$message .= '<h1>Hi ' . $name . '!</h1>';
$message .= '<p><a href="'.SITE_URL.'activate.php?id=' . base64_encode($lastID) . '">CLICK TO ACTIVATE YOUR ACCOUNT</a>';
$message .= "</body></html>";
// php mailer code starts
$mail = new PHPMailer(true);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.mail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = '[email protected]';
$mail->Password = 'shivaji.MS';
$mail->SetFrom('[email protected]', 'shivaji');
$mail->AddAddress($email);
$mail->Subject = trim("Email Verifcation ");
$mail->MsgHTML($message);
try {
$mail->send();
$msg = "An email has been sent for verfication.";
$msgType = "success";
} catch (Exception $ex) {
$msg = $ex->getMessage();
$msgType = "warning";
}
} else {
$msg = "Failed to create User";
$msgType = "warning";
}