-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmailer.php
28 lines (25 loc) · 898 Bytes
/
mailer.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
<?php
ini_set("log_errors", 1);
ini_set("error_log", getcwd()."/php-error.log");
use PHPMailer\PHPMailer\PHPMailer;
require 'vendor/autoload.php';
require_once("base.php");
if (array_key_exists('first_name', $_POST)) {
$mail = new PHPMailer();
$mail->setFrom($_POST['email'], $_POST['first_name']);
$mail->addReplyTo($_POST['email'], $_POST['first_name']);
$mail->addAddress('[email protected]', 'Afgral LGM'); // adds new recipients
$mail->addCC($_POST['email'], $_POST['first_name']);
$mail->Subject = '[CONTACT] LGM Website';
$mail->isHTML(false);
$mail->Body = "sample text";
$mail->Body = $_POST['message'];
if (!$mail->send()) {
# Message not sent !
header('Location:en/contact_fail.html');
#echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
# Message sent!
header('Location:en/contact_sent.html');
}
}