Ich versuche, eine E-Mail von localhost zu meinem Yahoo Account mit php mail() -Funktion zu senden, die Rückkehr sagt, dass ich die E-Mail erfolgreich gesendet habe, aber ich habe keine E-Mail erhalten . Ich habe viele so genannte "einfache Wege" gelesen und versucht, E-Mails zu verschicken, aber das Ergebnis ist enttäuschend, nichts davon funktioniert für mich. Im Folgenden finden Sie den Code, die Konfigurationen und die Fehlermeldung. Kann mich jemand damit aufklären? Vielen Dank.Senden Sie eine E-Mail von localhost XAMMP in PHP mit GMAIL Mail-Server
PHP-Code
<?php
$to = '[email protected]';
$subject = 'Fake sendmail test';
$message = 'If we can read this, it means that our fake Sendmail setup works!';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to, $subject, $message, $headers)) {
echo 'Email sent successfully!';
} else {
die('Failure: Email was not sent!');
}
?>
Konfiguration für php.ini (Ich bin mit gmail-Mail-Server)
SMTP = smtp.gmail.com
smtp_port = 587
sendmail_from = myemail @ gmail.com
sendmail_path = "\" C: \ xampp \ sendmail \ sendmail.exe \ "-t"
Konfiguration für sendmail.ini
smtp_server = smtp.gmail.com
smtp_port = 587
smtp_ssl = tls
error_logfile = error.log
debug_logfile = debug.log
auth_username = myemail @ gmail.com
AUTH_PASSWORD = mypassword
[email protected]
Fehlermeldung in Sendmail-Fehlerprotokoll mit Port 587
13/10/02 13:36:41: Muss zuerst einen STARTTLS-Befehl ausgeben. k4sm129639pbd.11 - gsmtp
Ein Detail Blog: http://goo.gl/O1zw89 –