Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $mail = new PHPMailer;
- $mail->SMTPDebug = 3;
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'mail.mydomain.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'contact@mydomain.com'; // SMTP username
- $mail->Password = 'pass'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 465; // TCP port to connect to
- $mail->setFrom('contact@mydomain.com', 'my name');
- $mail->addAddress('....@gmail.com', 'someone'); // Add a recipient
- $mail->addReplyTo('contact@mydomain.com', 'my name');
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = 'subject';
- $mail->Body = 'msg body <b>bold!</b>';
- $mail->AltBody = 'Corpo alternativo caso o primeiro não seja exibido';
- if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- } else {
- echo 'Message has been sent';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement