Quantcast
Channel: MarsHut
Viewing all articles
Browse latest Browse all 6551

SMTP error handling

$
0
0
We're preparing documentation for smtp class.

I'm also working on a patch for Send() Dialog() methods.

my question is, in send() you throw user_error if a required header key is
missing

but if no socket, you don't throw user_error, you just echo "no socket"
then return FALSE;

my patch changes that to throw an error if no socket, and also error if no
OpenSSL, and if From is empty, and To or Cc or Bcc is empty.

do you think this is a good idea?
if an email is not sent, for whatever reason, I think it should throw an
error...

it will force the dev to fix the error during development testing,
and we can also add to documentation to tell dev to make sure they are
checking user provided data for proper email address format to prevent
errors during production.

but it might be better to use the new $HALT variable, i.e. the script would
not stop due to error, but the error would be logged for admin alerting
troubleshoooting?

I tried using err code 512 to issue a warning
user_error(sprintf(self::E_Mailto,$rcpt_), 512); // warning
but the script still stopped with Internal Server Error

obviously setting QUIET = 1 will not show the error, but I'm wondering if
there is a better way?

i.e. creating a new method to handle warnings (not fatal errors) and email
the website admin with details of the warning.

or does php have a better way like user_error / user_warning ?

or does that need to be a user defined function or we create one in the
framework?

Viewing all articles
Browse latest Browse all 6551

Trending Articles