PHPMailer não funciona no servidor online
Boa noite!
Uso o PHPMailer, e o envio quando o site está hospedado em um servidor local ocorre tudo certo, entretanto, quando enviado a partir de um servidor online ele não dá certo, ocorre um erro, segue o debug:
Connection: opening to smtp.live.com:587, timeout=300, options=array ()
Connection: opened
SERVER -> CLIENT: 220 BLU436-SMTP112.smtp.hotmail.com Microsoft ESMTP MAIL Service, Version: 8.0.9200.16384 ready at Tue, 13 Dec 2016 16:09:24 -0800
CLIENT -> SERVER: EHLO ifsertao-pe-afranio.pe.hu
SERVER -> CLIENT: 250-BLU436-SMTP112.smtp.hotmail.com Hello [31.170.166.34]250-TURN250-SIZE 41943040250-ETRN250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-8bitmime250-BINARYMIME250-CHUNKING250-VRFY250-TLS250-STARTTLS250 OK
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 2.0.0 SMTP server ready
CLIENT -> SERVER: EHLO site.com.br
SERVER -> CLIENT: 250-BLU436-SMTP112.smtp.hotmail.com Hello [31.170.166.34]250-TURN250-SIZE 41943040250-ETRN250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-8bitmime250-BINARYMIME250-CHUNKING250-VRFY250-AUTH LOGIN PLAIN XOAUTH2250 OK
CLIENT -> SERVER: AUTH LOGIN
SERVER -> CLIENT: 334 VXNlcm5hbWU6
CLIENT -> SERVER: aWZzZXJ0YW8tcGUtYWZyYW5pb0BvdXRsb29rLmNvbQ==
SERVER -> CLIENT: 334 UGFzc3dvcmQ6
CLIENT -> SERVER: Y2VudHJvYWZyYW5pbzE2
SERVER -> CLIENT: 235 2.7.0 Authentication succeeded
CLIENT -> SERVER: MAIL FROM:<email@hotmail.com>
SERVER -> CLIENT: 250 2.1.0 email@hotmail.com....Sender OK
CLIENT -> SERVER: RCPT TO:<email2@outlook.com>
SERVER -> CLIENT: 250 2.1.5 email2@outlook.com
CLIENT -> SERVER: DATA
SERVER -> CLIENT: 354 Start mail input; end with <CRLF>.<CRLF>
CLIENT -> SERVER: Date: Tue, 13 Dec 2016 21:09:10 -0300
CLIENT -> SERVER: To: =?UTF-8?Q?IF_SERT=C3O_PE_-_Centro_de_Refer=EAncia_de_Afr=E2nio?= <email2@outlook.com>
CLIENT -> SERVER: From: Nome <email2@hotmail.com>
CLIENT -> SERVER: Reply-To: Nome <email2@hotmail.com>
CLIENT -> SERVER: Subject: ajsdasd
CLIENT -> SERVER: Message-ID: <ba9ab7d6e3beb5a1ab88e21a743d5ac7@site.com.br>
CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.16 (https://github.com/PHPMailer/PHPMailer)
CLIENT -> SERVER: MIME-Version: 1.0
CLIENT -> SERVER: Content-Type: multipart/alternative;
CLIENT -> SERVER: boundary="b1_ba9ab7d6e3beb5a1ab88e21a743d5ac7"
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER: This is a multi-part message in MIME format.
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_ba9ab7d6e3beb5a1ab88e21a743d5ac7
CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
CLIENT -> SERVER:
CLIENT -> SERVER: asdad
CLIENT -> SERVER: Nova mensagem via contato do site:Nome: nomeE-mail: email@hotmail.com
CLIENT -> SERVER: Assunto: ajsdasdData: 13/12/2016 21:09
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_ba9ab7d6e3beb5a1ab88e21a743d5ac7
CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
CLIENT -> SERVER:
CLIENT -> SERVER: <p style="font: 14px 'Trebuchet MS', Arial, Helvetica, sans-serif; color:#333">asdad</p><hr>
CLIENT -> SERVER: <h4>Nova mensagem via contato do site:</h4><p><strong>Nome: </strong>nome<br><strong>E-mail: </strong>email@hotmail.com<br>
CLIENT -> SERVER: <strong>Assunto: </strong>ajsdasd<br><strong>Data: </strong>13/12/2016 21:09</p>CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_ba9ab7d6e3beb5a1ab88e21a743d5ac7--
CLIENT -> SERVER:
CLIENT -> SERVER: .
SERVER -> CLIENT: 550 5.3.4 554-554 5.2.0 STOREDRV.Deliver; delivery result banner
**SMTP ERROR: DATA END command failed: 550 5.3.4 554-554 5.2.0 STOREDRV.Deliver; delivery result banner
SMTP Error: data not accepted.**
Função do php para envio do e-mail:
function sendMail($subject, $message, $sender, $senderName, $destination, $destinationName, $reply = NULL, $replyName = NULL) {
require ('mail/PHPMailerAutoload.php');
$mailer = new PHPMailer;
$mailer->isSMTP();
$mailer->SMTPDebug = 3;
$mailer->Debugoutput = 'html';
$mailer->CharSet = 'UTF-8';
$mailer->SMTPAuth = true;
$mailer->SMTPSecure = 'tls';
$mailer->Host = mailhost;
$mailer->Port = mailport;
$mailer->Username = mailuser;
$mailer->Password = mailpass;
$mailer->SetFrom($sender, utf8_decode($senderName));
if ($reply) {
$mailer->AddReplyTo($reply, utf8_decode($replyName));
}
$mailer->AddAddress($destination, utf8_decode($destinationName));
$mailer->Subject = "$subject";
$mailer->isHTML(true);
$mailer->Body = $message;
$mailer->AltBody = strip_tags($message);
if ($mailer->send()) {
echo "<script>alert('E-mail enviado com sucesso!');</script>";
} else {
$error = 'Error -> '.$mailer->ErrorInfo;
// echo "<script>alert('$error');</script>";
die("$error");
}
}Discussão (5)
Carregando comentários...