Re: SMTP return values
| From: | Xavier Noguer | Date: | Mon, 06 Jan 2003 13:24:35 +0000 |
| Subject: | Re: SMTP return values | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-12162@lists.php.net to get a copy of this message | ||
El Dom 05 Ene 2003 23:05, Jon Parise escribió:
> 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.
I havn't even used the class, so I'm going out on a limb here, but I think
you could have a couple of methods getLastRespondeCode() and getLastMessage()
to return the last code and message from a successful SMTP call. That way you
would keep backwards compatibilty.
Does that make any sense?
> 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.