-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail_function.php
More file actions
65 lines (42 loc) · 1.13 KB
/
Copy pathmail_function.php
File metadata and controls
65 lines (42 loc) · 1.13 KB
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
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
/* EMAIL SWITCH */
$EMAIL_ENABLED = true;
function sendPortalMail($to, $subject, $message)
{
global $EMAIL_ENABLED;
if(!$EMAIL_ENABLED)
{
return true;
}
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
// Hostinger SMTP settings
$mail->Host = 'smtp.hostinger.com';
$mail->SMTPAuth = true;
// Your mailbox
$mail->Username = 'noreply@mitinternship.online';
// Mailbox password (IMPORTANT)
$mail->Password = 'Wdcsi@2026';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
$mail->setFrom(
'noreply@mitinternship.online',
'MIT Internship Portal'
);
$mail->addAddress($to);
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->send();
return true;
} catch (Exception $e) {
return false;
}
}
?>