[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash Script for Mail sending Check



Hi Tapani Tarvainen,

I got your modification working only when telnet gives a prompt,
something like,

kurianmt@debian:~$ telnet 192.168.0.20 25
Trying 192.168.0.20...
Connected to 192.168.0.20.
Escape character is '^]'.
220 rhel.virusk.org ESMTP Sendmail 8.13.8/8.13.8; Tue, 14 Apr 2009
22:34:26 +0530

But, when this server has a firewall block, then,

kurianmt@debian:~$ telnet 192.168.0.20 25
Trying 192.168.0.20...

So, it didn't bring us to the telnet prompt and I think, it works only
when telnet is successful and gives a prompt. Do advice.

Regards,

Kurian Thayil.

On Thu, 2009-04-16 at 08:19 +0300, Tapani Tarvainen wrote:
> You could abort the telnet using its escape sequence instead of
> using smtp quit, i.e.,
> 
> #! /bin/bash
> case "$( (sleep 5; echo -e '\033q') | telnet 192.168.0.20 25 2>&- )"
> in
>   *'
> 220 '*) echo Success ;;
>   *)    echo Failed ;;
> esac
> 
> If you want to be friendly to the mail server you could do both:
> 
> case "$( (sleep 5; echo quit; sleep 5; echo -e '\033q') | telnet
> 192.168.0.20 25 2>&- )" in
> 
> That will look a bit nicer in the mail server logs and may avoid
> tripping some spam/attack detection tools.
> 
> Also, you may need to adjust the delays: the time a mail server
> takes to respond to initial connection may vary a lot,
> depending on things like its load and whatnot.
> Quite a few even deliberately wait some 10 seconds just
> to trip spamming software known to be too impatient.
-- 
Kurian Mathew Thayil.
(GPG KeyID: E232394F)

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: