On Tuesday 21 Aug 2012, Ruben Rögels wrote:
> Hello,
> 
> no problem at all, I think this is the tricky part.
> 
> A smtp dialogue between your email client and a smtp server normally
> looks like this:
> 
> user@box:~? netcat mx1.example.com
> 220 postfix ESMTP mx1.example.com
> helo me.local
> 250 mx1.example.com
> mail from: <[email protected]>
> 250 2.1.0 Ok
> rcpt to: <[email protected]>
> 450 5.7.1 <[email protected]>: Mailbox Full
> 
> The tricky part is writing or finding a console smtp client that
> gives you feedback about the 450 error that just happened.
> Right now I cannot give you a precise way to do that, but I have
> basic understanding of the technology, so I know that it is possible
> to do so ;-)
> 
> I'm looking around in the net, because I think I'll soon have to
> handle your problem aswell in my company ;-)
> If I can find solution, I'll post it.

Something like this ought to do it:

(sleep 5; echo HELO foo; sleep 1; \
  echo mail from: [email protected]; sleep 1; \
  echo rcpt to: [email protected]; sleep 1; \
  echo data; echo test; echo .; sleep 1; echo quit) | \
  telnet mail.ho.st 25 2>&1 | fgrep -q '450 5.7.1' && notify-user.sh

Of course, it's probably better to wrap this into a Perl or equivalent 
script, but it should work on the shell too.

Regards,

-- Raj
-- 
Raj Mathur                          || [email protected]   || GPG:
http://otheronepercent.blogspot.com || http://kandalaya.org || CC68
It is the mind that moves           || http://schizoid.in   || D17F

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to