Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Import PHPMailer classes into the global namespace
- // These must be at the top of your script, not inside a function
- use PHPMailerPHPMailerPHPMailer;
- use PHPMailerPHPMailerException;
- //Load composer's autoloader
- require 'PHPMailer/PHPMailer.php';
- require 'PHPMailer/SMTP.php';
- require 'PHPMailer/Exception.php';
- $mail = new PHPMailer(true);
- try {
- //Server settings
- $mail->SMTPDebug = 2;
- $mail->isSMTP();
- $mail->Host = 'smtp.dominiodahostnet.com.br';
- $mail->SMTPAuth = true;
- $mail->Username = 'usuario=dominiodahostnet.com.br';
- // SMTP username
- $mail->Password = '****';
- $mail->SMTPAutoTLS = false;
- $mail->Port = 587;
- //Recipients
- $mail->setFrom('from@dominiodahostnet.com.br', 'Mailer');
- $mail->addAddress('address@dominiodahostnet.com.br', 'Joe User');
- //$mail->addAddress('ellen@example.com'); l
- //$mail->addReplyTo('info@example.com', 'Information');
- //$mail->addCC('cc@example.com');
- //$mail->addBCC('bcc@example.com');
- //Attachments
- //$mail->addAttachment('/var/tmp/file.tar.gz');
- //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');
- //Content
- $mail->isHTML(true);
- $mail->Subject = 'Here is the subject';
- $mail->Body = 'This is the HTML message body <b>in bold!</b>';
- $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
- $mail->send();
- echo 'Message has been sent';
- } catch (Exception $e) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- }
- 2017-09-20 19:24:23 SERVER -> CLIENT: 220 smtpq.f1.k8.com.br ESMTP Postfix
- 2017-09-20 19:24:23 CLIENT -> SERVER: EHLO localhost
- 2017-09-20 19:24:23 SERVER -> CLIENT: 250-smtpq.f1.k8.com.br250-PIPELINING250-SIZE 33554432250-ETRN250-STARTTLS250-AUTH PLAIN LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN
- 2017-09-20 19:24:23 CLIENT -> SERVER: MAIL FROM:<miguel@dominiodahostnet.com.br>
- 2017-09-20 19:24:23 SERVER -> CLIENT: 250 2.1.0 Ok
- 2017-09-20 19:24:23 CLIENT -> SERVER: RCPT TO:<contato@dominiodahostnet.com.br>
- 2017-09-20 19:24:24 SERVER -> CLIENT: 554 5.7.1 <unknown[179.223.237.28]>: Client host rejected: Access denied
- 2017-09-20 19:24:24 SMTP ERROR: RCPT TO command failed: 554 5.7.1 <unknown[179.223.237.28]>: Client host rejected: Access denied
- 2017-09-20 19:24:24 CLIENT -> SERVER: QUIT
- 2017-09-20 19:24:24 SERVER -> CLIENT: 221 2.0.0 Bye
- SMTP Error: The following recipients failed: contato@dominiodahostnet.com.br: <unknown[179.223.237.28]>: Client host rejected: Access denied
- Message could not be sent. Mensagem de Error: SMTP Error: The following recipients failed: contato@dominiodahostnet.com.br: : Client host rejected: Access denied
- $mail->SMTPSecure = 'tls';
- $mail->SMTPSecure = 'ssl';
- ;extension=php_openssl.dll
- ;extension=openssl.so
- $mail->SMTPSecure = false;
- $mail->SMTPAutoTLS = false;
- $mail->Username = 'usuario=dominiodahostnet.com.br';
- $mail->Username = 'usuario@dominiodahostnet.com.br';
- $mail->Username = 'usuario';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement