note 26245 deleted from function.mail by sniper

From: Date: Wed, 29 Jan 2003 12:42:02 +0000
Subject: note 26245 deleted from function.mail by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-43060@lists.php.net to get a copy of this message
In response to GreyWyvern's code for a quick way to send mail using SMTP, I would suggesst adding fputs ($connect, "RSET"."\r\n"); before the line fputs ($connect, "MAIL FROM:$fromAddr"."\r\n"); In case of any error causing the state to be inconsistent. His/Her code assumes that the to, from, and header are all valid and that there isn't any special cases that might cause the server to reject a command. Cases such as invalid TO field, mail box busy, mail box storage exceeded, etc.. Also, the code should be modified to detect did the mail server close the connection each time an attempt to send a mail is make. This can be done by detecting the code 221 or 421 returned by the mail server. I learn this mistake the hard way after wondering why my client's email list doesn't get send out. Dreamywind

« previous php.notes (#43060) next »