-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail.php
49 lines (31 loc) · 1.45 KB
/
email.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
41
42
43
44
45
46
47
48
49
<?
require 'phpmailer/PHPMailerAutoload.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 = '[email protected]'; // SMTP username
$mail->Password = 'phweb123'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->setFrom('[email protected]', 'GLC SITE');
$mail->addAddress("[email protected]");
//$mail->addCC("[email protected]");// Add a recipient
// Add attachments
// Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = "Novo form de contato preenchido!";
$nome = $_POST['name'];
$email = $_POST['email'];
$num = $_POST['num'];
$txt = "Nova Form de Contato preenchida!\n Nome: $nome \n Email: $email \n \n Número: $num";
$mail->Body = $txt;
if(!$mail->send()) {
$error = $mail->ErrorInfo;
die(json_encode(array("status"=>"error","detail"=>$error)));
} else {
}
//complete
die(json_encode(array("status"=>"ok","detail"=>"ok")));
?>