-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvio.php
52 lines (39 loc) · 1.6 KB
/
envio.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
50
51
52
<?php
require 'lib/phpmailer/PHPMailerAutoload.php';
$nome = $_POST['nome'];
$email = $_POST['email'];
$msg = $_POST['msg'];
$msg = utf8_decode($msg);
$body = "";
$mail = new PHPMailer;
$body .= "<h2>Form de Contato</h2>";
$body .= "Nome: $nome <br>";
$body .= "E-mail: $email <br>";
$body .= "Mensagem:<br>";
$body .= $msg;
$body .= "<br>";
$body .= "----------------------------";
$body .= "<br>";
$body .= "Enviado em <strong>".date("h:m:i d/m/Y")." por ".$_SERVER['REMOTE_ADDR']."</strong>"; //mostra a data e o IP
$body .= "<br>";
$body .= "----------------------------";
$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.99moteis.com.br'; // Specify main and backup server
$mail->Port = 587; // Set the SMTP port
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'mudarsenha123@'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->From = '[email protected]';
$mail->FromName = $nome;
$mail->AddAddress('[email protected]', '99 Motéis'); // Add a recipient
$mail->IsHTML(true); // Set email format to HTML
$mail->Subject = 'Form de Contato';
$mail->Body = $body;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->Send()) {
echo 'A mensagem não foi enviada!';
echo 'Erro: ' . $mail->ErrorInfo;
exit;
}
?>