Net::SMTP Unexpected EOF error
Posted on 2003-10-25
I've searched the net, and couldn't find anything about a problem I'm having with Net::SMTP.
Could you suggest something or direct me somewhere about this problem ? Ultimately I'm looking to get it resolved.
I get the error at various parts of the SMTP conversation, either after $smtp->to or $stmp->dataend(), etc.
The logs are like this:
Net::SMTP: Unexpected EOF on command channel at smtp.pl line 163
From what it looks like, remote server drops the connection unexpectedly, yet I may be wrong. I want to be able to know when this happens, so I can deal with it in my script.
I tried if (undef($stmp)) die "EOF error again";
However, this doesn't do it. Even though $smtp should NOT be defined anymore, it seems to still 'be there", and program skips right past it. Hence the script continues on (much faster though, since it doesn't really send anymore), and tells me that ALL emails were sent, when in fact the script stopped sending emails after the EOF error. The only way to find out where it really stopped sending is to go to the log, where I found that EOF error. What I want to do is to automatically stop any and all processing when that error happens. In other words, do something like throw () catch () exception handling and deal with it from there. Or anything else that will do the job.
Is there a way to do that ?