-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorder.php
More file actions
49 lines (37 loc) · 1.63 KB
/
order.php
File metadata and controls
49 lines (37 loc) · 1.63 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
<?php
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$nif = $_POST["nif"];
$morada = $_POST["morada"];
$send = $_POST["send"];
$total = $_POST["total"];
$checkoutData = $_POST["checkoutData"];
ob_start();
include 'mailtpl.php';
$myvar = ob_get_clean();
//print_r($myvar);
require 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'futureledencomendas@gmail.com'; // SMTP username
$mail->Password = 'benfica3'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->CharSet = 'UTF-8';
$mail->Port = 465; // TCP port to connect to
$mail->setFrom('encomendas@futureled.pt', 'Future LED');
$mail->addAddress('encomendas@futureled.pt', 'Recepcionista'); // Add a recipient
$mail->addReplyTo('no-reply@futureled.pt', 'Information');
$mail->addBCC('aleksei.borsenko.dev@gmail.com', 'Developer');
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Uma nova encomenda para '.$email;
$mail->Body = $myvar;
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}