SMTP return values
| From: | Jon Parise | Date: | Mon, 06 Jan 2003 02:05:00 +0000 |
| Subject: | SMTP return values | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-12151@lists.php.net to get a copy of this message | ||
As you've probably seen, I've been refactoring the Net_SMTP package a
bit.
The current class interface provides methods that map directory to
their SMTP command counterparts (e.g. helo(), data(), vrfy()). At the
moment, these methods return either 'true' upon success or a PEAR_Error
object if a failure condition is encountered.
I'm considering changing the API to instead return a 2-tuple
containing the SMTP response code and message instead of the rather
vague 'true' value. Errors would still result in a PEAR_Error object
being returned.
This change would make the class slightly more difficult to use as the
burden of checking for a correct response code would fall to the user.
The class would become more flexible, however, in that it would expose
more of the details regarding the SMTP conversation.
At this point, I can see arguments either way, and I don't have an
incredibly strong preference for one implementation over the other. I
think it's worth some thoughtful discussion, however, which is why I
introduce the topic here.
--
Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)