Mailinglisten-Archive |
Hallo! Da bei mir (unter win32) das mail auch nicht richtig funzt (ab PHP3.0.12 stürzt es nur noch ab), habe ich mit Hilfe einer Anleitung einer Webseite (URL?) folgende Funktion implementiert/abgeschrieben/angeändert: define("EMAILSENDER", "me_(at)_somewhere.de"); define("EMAILRECEIVER", "customer_(at)_hisdomain.de"); define("EMAILSERVER", "hisdomain.de"); function TransmitMyMail($nFilepointer, $sSubject, $sMsg) { //locals $sHeader = ""; $sLine = ""; $sHeader = "From: ".EMAILSENDER."\n"; $sHeader = $sHeader."To: ".EMAILRECEIVER."\n"; $sHeader = $sHeader."Reply-To: ".EMAILSENDER."\n"; $sHeader = $sHeader."Subject: ".$sSubject."\r\n"; if( !($sLine = fgets($nFilepointer, 1024)) ) return FALSE; if( !(fputs($nFilepointer, "HELO localhost\r\n")) ) return FALSE; if( !($sLine = fgets($nFilepointer, 1024)) ) return FALSE; if( !(fputs($nFilepointer, "MAIL FROM: ".EMAILSENDER."\r\n")) ) return FALSE; if( !($sLine = fgets($nFilepointer, 1024)) ) return FALSE; if( !(fputs($nFilepointer, "RCPT TO: ".EMAILRECEIVER."\r\n")) ) return FALSE; if( !($sLine = fgets($nFilepointer, 1024)) ) return FALSE; if( !(fputs($nFilepointer, "DATA\r\n")) ) return FALSE; if( !($sLine = fgets($nFilepointer, 1024)) ) return FALSE; if( !(fputs($nFilepointer, $sHeader."\r\n\r\n")) ) return FALSE; if( !(fputs($nFilepointer, $sMsg."\r\n")) ) return FALSE; if( !(fputs($nFilepointer, ".\r\n")) ) return FALSE; if( !($sLine = fgets($nFilepointer, 1024)) ) return FALSE; if( !(fputs($nFilepointer, "QUIT\r\n")) ) return FALSE; if( !($sLine = fgets($nFilepointer, 1024)) ) return FALSE; return TRUE; }; function SendMyMail($sSubject, $sMsg) { //locals $nFilepointer = 0; $bSendStatus = FALSE; if( !($nFilepointer = fsockopen(EMAILSERVER, 25)) ) return FALSE; $bSendStatus = TransmitMyMail($nFilepointer, $sSubject, $sMsg); fclose($nFilepointer); return $bSendStatus; }; Aufruf z.B. SendMyMail("Automatische Emailanfrage", "Hello World!"); Bei mir läuft das einwandfrei :-) Gruß vom Frank (Hoffe das hilft!?) ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
php::bar PHP Wiki - Listenarchive