-
Notifications
You must be signed in to change notification settings - Fork 1
/
mail-util.php
35 lines (26 loc) · 888 Bytes
/
mail-util.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
<?php
/**
* External library
* Using the PHP Mailer from https://github.com/PHPMailer/PHPMailer
*/
use PHPMailer\PHPMailer\PHPMailer;
require_once './PHPMailer/src/PHPMailer.php';
require_once './PHPMailer/src/Exception.php';
require_once './PHPMailer/src/SMTP.php';
function sendEmail($to, $name, $title, $message) {
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'smtp.googlemail.com'; //gmail SMTP server
$mail->SMTPAuth = true;
$mail->Username = 'michiel.swaanen.gsm@gmail.com'; //username
$mail->Password = 'qf#QWJAe76Sp^I27wTDEFWATB60@z5'; //password
$mail->SMTPSecure = 'ssl';
$mail->Port = 465; //SMTP port
$mail->setFrom('noreply@fuiver.com', 'Fuiver');
$mail->addAddress($to, $name);
$mail->isHTML(true);
$mail->Subject = $title;
$mail->Body = $message;
$mail->send();
}
?>