-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenviamail.php
54 lines (41 loc) · 1.2 KB
/
enviamail.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
53
54
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
include_once "vendor/autoload.php";
function EnviaEmail($emaildestinatario, $nomedestinatario, $assunto, $mensagem)
{
$mail = new PHPMailer();
//$mail->SetLanguage("br", "phpmailer/phpmailer.lang-pt_br.php");
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->IsSMTP();
$mail->CharSet = "UTF-8";
$mail->ContentType = "Content-Type: text/html";
$mail->Encoding = "base64";
$mail->SMTPAuth = true;
$mail->SMTPDebug = 2;
//$mail->SMTPAutoTLS = false;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.dominio.com.br";
$mail->Port = 465;
//$mail->From = "[email protected]";
$mail->Username = "[email protected]";
$mail->Password = "";
$mail->SetFrom("[email protected]","NOME");
$mail->AddAddress($emaildestinatario, $nomedestinatario);
$mail->IsHTML(true);
$mail->Subject = $assunto;
$mail->MsgHTML($mensagem);
//e-mail em cópia
//$mail->addCC("[email protected]", "NOME");
//e-mail em cópia oculta
//$mail->addBCC("[email protected]", "NOME");
if($mail->Send())
return 1;
else return 0;
}