Skip to content

Instantly share code, notes, and snippets.

@brunocmoraes
Created April 6, 2020 19:25
Show Gist options
  • Save brunocmoraes/e826a8c2b1221cff58c1702c87a53b03 to your computer and use it in GitHub Desktop.
Save brunocmoraes/e826a8c2b1221cff58c1702c87a53b03 to your computer and use it in GitHub Desktop.
Envio de e-mail na caixa de entrada com Php Mailer
require 'vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer(true);
$mail->CharSet = 'UTF-8';
$mail->setLanguage('pt_br');
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = 'mail.caqo.com.br';
$mail->SMTPAuth = true;
$mail->Username = 'e-mail@queenvia.com';
$mail->Password = 'xxx';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->Subject = 'Assunto da mensagem';
$mail->isHTML(true);
$mail->setFrom($mail->Username, 'CAQO Marketing');
$mail->addAddress('e-mail@querecebe.com', 'Nome que recebe');
$message = 'html da mensagem';
$mail->Body = $message;
$mail->AltBody = ''; // versão txt do e-mail (sem html)
$mail->send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment