Re: SMTP return values
| From: | Martin Jansen | Date: | Mon, 06 Jan 2003 13:14:31 +0000 |
| Subject: | Re: SMTP return values | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-12159@lists.php.net to get a copy of this message | ||
On Sun Jan 05, 2003 at 09:0500PM -0500, Jon Parise wrote:
> 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.
Do you see any chance to implement a method Net_SMTP::isError(),
that can help the user to determine if the response code indicates
a positive or a negative result? If such a method would be
feasible, the class will not be much harder to use.
--
- Martin Martin Jansen
http://martinjansen.com/