note 26245 added to function.mail
| From: | dreamywind at yahoo dot com | Date: | Wed, 23 Oct 2002 21:21:59 +0000 |
| Subject: | note 26245 added to function.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38468@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
--
http://www.php.net/manual/en/function.mail.php
http://master.php.net/manage/user-notes.php?action=edit+26245
http://master.php.net/manage/user-notes.php?action=delete+26245
http://master.php.net/manage/user-notes.php?action=reject+26245