Hallo zusammen,
ich verwende für den Versand von Mails über einen GMX-Account die Klasse smtp von Manuel Lemos (http://www.phpclasses.org/browse/package/14.html).
Wenn ich das mitgelieferte Test-Script verwende funktioniert der Versand. Wenn ich hingegen meine eigene Funktion verwende, bekomme ich den folgenden Fehler: could not determine the SMTP to connect
Für beide Scripte verwende ich die gleichen Daten.
Test-Script:
Eigene Funktion:
Hat jemand eine Idee, warum es beim Test geht und bei meiner Funktion nicht?
Gruß,
Ole
ich verwende für den Versand von Mails über einen GMX-Account die Klasse smtp von Manuel Lemos (http://www.phpclasses.org/browse/package/14.html).
Wenn ich das mitgelieferte Test-Script verwende funktioniert der Versand. Wenn ich hingegen meine eigene Funktion verwende, bekomme ich den folgenden Fehler: could not determine the SMTP to connect
Für beide Scripte verwende ich die gleichen Daten.
Test-Script:
Code:
<?php $smtp = new smtp_class; $smtp->host_name=$host_name; $smtp->localhost=$localhost; $smtp->pop3_auth_host=$pop3_auth_host; $smtp->user=$mail_user; $smtp->realm=$realm; $smtp->password=$mail_password; $from=$mail_from; $to=$mailaddress; $inhalt = $mailtext; $smtp->direct_delivery=0; /* Set to 1 to deliver directly to the recepient SMTP server */ $smtp->timeout=10; /* Set to the number of seconds wait for a successful connection to the SMTP server */ $smtp->data_timeout=0; /* Set to the number seconds wait for sending or retrieving data from the SMTP server. Set to 0 to use the same defined in the timeout variable */ $smtp->debug=0; /* Set to 1 to output the communication with the SMTP server */ $smtp->html_debug=1; /* Set to 1 to format the debug output as HTML */ if( $smtp->SendMessage($from, array($to), array( "From: $from", "To: $to", "Subject: ".$betreff, "Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z") ), $inhalt)) echo "Message sent to $to OK.\n"; else echo "Cound not send the message to $to.\nError: ".$smtp->error."\n" ?>
Eigene Funktion:
Code:
function sendEMail($empfaenger, $betreff, $mailtext) { $smtp = new smtp_class; //$smtp->host_name=getenv("HOSTNAME"); $smtp->host_name=$host_name; $smtp->localhost=$localhost; $smtp->pop3_auth_host=$pop3_auth_host; $smtp->user=$mail_user; $smtp->realm=$realm; $smtp->password=$mail_password; $from=$mail_from; $to=$mailaddress; // $to = $empfaenger; $inhalt = $mailtext; $smtp->direct_delivery=0; /* Set to 1 to deliver directly to the recepient SMTP server */ $smtp->timeout=10; /* Set to the number of seconds wait for a successful connection to the SMTP server */ $smtp->data_timeout=0; /* Set to the number seconds wait for sending or retrieving data from the SMTP server. Set to 0 to use the same defined in the timeout variable */ $smtp->debug=0; /* Set to 1 to output the communication with the SMTP server */ $smtp->html_debug=1; /* Set to 1 to format the debug output as HTML */ if($smtp->SendMessage($from, array($to), array( "From: $from", "To: $to", "Subject: ".$betreff, "Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z") ), $inhalt)) { echo "Die Nachricht wurde erfolgreich an '$to' geschickt.\n"; } else { echo "Die Nachricht konnte nicht an '$to' gesendet werden.\nFehler: ".$smtp->error."\n"; } }
Gruß,
Ole
Kommentar