Possible Duplicate:
Having trouble with PHPMailerphpmailer senden gmail smtp Timeout
Es gibt viele ähnliche Fragen, aber keiner von ihnen hat mir geholfen.
Hier ist mein Skript, das in dem phpmailer exmaples vorgesehen ist:
require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
try {
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "yourpassword"; // GMAIL password
$mail->AddReplyTo('[email protected]', 'First Last');
$mail->AddAddress('[email protected]', 'John Doe');
$mail->SetFrom('[email protected]', 'First Last');
$mail->AddReplyTo('[email protected]', 'First Last');
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML("some message");
$mail->Send();
echo "Message Sent OK</p>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
und hier ist der Fehler:
SMTP -> ERROR: Failed to connect to server: Connection timed out (110)
SMTP Error: Could not connect to SMTP host.
in vielen Fragen erwähnt wurde php_openssl extenstion
zu ermöglichen, die in meinem Server aktiviert ist. Ich verwende PHPmailer Version 5.1
auch gibt es kein Problem mit meinem Server-Port 25 und einfache mail()
Funktion funktioniert
Danke für Ihre Hilfe
Ping den Host \ Port vom selben Server, falls es ein Netzwerkproblem ist –
@Dagon: Ping ohne Probleme. Ich habe auch bei localhost versucht, und es gibt das gleiche Problem. Ich habe vor vielen Monaten viele E-Mails mit diesem Ansatz gesendet und es funktionierte gut, aber jetzt habe ich vergessen, wie ... – Aliweb