• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

PHP Mailer lädt nicht

Timer

Mitglied
Hey,
ich hab nun versucht, den PHPMailer zu benutzen. Ich habe dafür den Example-Code von github leicht abgeändert hinzugefügt. Leider lädt die Seite nicht und nach ewiger Zeit kommt folgender Fehler:
Code:
Fatal error: Maximum execution time of 30 seconds exceeded in D:\xampp\htdocs\vendor\phpmailer\phpmailer\src\SMTP.php on line 1124
Der Code der Seite, die ich aufrufe:
PHP:
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

$mail = new PHPMailer(true);
try {
    $mail->SMTPDebug = 1;
    $mail->isSMTP();
    $mail->Host = 'smtp.mail.yahoo.com';
    $mail->SMTPAuth = true;
    $mail->Username = 'meineMail';
    $mail->Password = 'meinPasswort';
    $mail->SMTPSecure = 'tls';
    $mail->Port = 465;

    $mail->setFrom('meineMail', 'Name');
    $mail->addAddress('andereMailAdresse', 'andererName');

    $mail->isHTML(true);
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';

    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
Hat jmd ne idee, woran das liegen kann?
 
Werbung:
Hab den Fehler gefunden. Anscheinend verträgt das PHPMailer Skript den Port 465 nicht. Ich habe den nun zum von Yahoo auch verfügbaren Port 587 geändert. Nun kommt folgender Fehler:
Code:
2018-03-29 13:42:05 SMTP NOTICE: EOF caught while checking if connected
SMTP Error: Could not authenticate.
SMTP Error: Could not authenticate.
Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.
 
Baue mal das hier ein:
PHP:
$mail->SMTPOptions = array('ssl' => array('verify_peer' => false,
                                                     'verify_peer_name' => false,
                                                     'allow_self_signed' => true)
                                     );
 
Werbung:
Ich bin mir leider nicht sicher, ob das an einer bestimmten Stelle sein muss. Ich habe es jetzt einfach mal testweise an den Anfang und an das Ende des SMTP-Blocks gestellt. Bringt beides leider nichts
 
Mach mal aus
PHP:
$mail->SMTPDebug = 1;
PHP:
$mail->SMTPDebug = 2;
 
Code:
2018-03-29 14:01:18 SERVER -> CLIENT:
2018-03-29 14:01:18 SMTP NOTICE: EOF caught while checking if connected
SMTP Error: Could not authenticate.
SMTP Error: Could not authenticate.
Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.
 
Werbung:
Ist ja auch nicht mehr, mach nochmal eine 3 rein. Im Moment würde ich sagen, dass die Zugangsdaten nicht stimmen. Leider habe ich keinen Yahoo-Account zum testen.
 
Code:
2018-03-29 14:04:54 Connection: opening to ssl://smtp.mail.yahoo.com:587, timeout=300, options=array()
2018-03-29 14:04:54 Connection failed. Error #2: stream_socket_client(): SSL: Der Vorgang wurde erfolgreich beendet. [D:\xampp\htdocs\vendor\phpmailer\phpmailer\src\SMTP.php line 325]
2018-03-29 14:04:54 Connection: opened
2018-03-29 14:04:54 SERVER -> CLIENT:
2018-03-29 14:04:54 SMTP NOTICE: EOF caught while checking if connected
2018-03-29 14:04:54 Connection: closed
SMTP Error: Could not authenticate.
SMTP Error: Could not authenticate.
Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.
Zugangsdaten sollten eigentlich funktionieren
 
Werbung:
Zurück
Oben