Ich habe versucht, eine E-Mail mit SMTP-Server in PHP-Mailer-Funktion zu senden.SMTP-Mail-Trigger funktioniert nicht
Das war der Fehler, wenn ich das ausgelöst habe.
Ich verwende den Gmail-Mail-Server.
SMTP-Verbindung() fehlgeschlagen.
require_once(TEMPLATEPATH . '/PHPMailer-master/PHPMailerAutoload.php');
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "smtp.gmail.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "xxxx";
//Password to use for SMTP authentication
$mail->Password = "xxxx";
//Set who the message is to be sent from
$mail->setFrom('xxxx', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('xxxxx', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('xxxx', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP test';
$mail->msgHTML('test');
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
Dies ist mein Code. Bitte schlagen Sie vor, was ist der Fehler in meinem Code oder wo zu smtp Verbindung fehlgeschlagen Fehler überprüfen.
Vielen Dank im Voraus.
alles in php_error? – Random
@Random keine PHP-Fehler –
gehören 'class.phpmailer.php' nicht die, die Sie einschließlich –