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

Bash Script for Mail sending Check



Hi All,

I need to write a BASH script which does a set of operations. But this
set of operations must be done only after checking if I am able to use a
relay server for sending mails. So, consider my client server where bash
script would be run as 192.168.0.10. Now, I need to execute a script
only after making sure that I am able to send mail using the relay
server 192.168.0.20 (Postfix enabled). Is it possible for me to write a
bash script which check this? I tried using the script but giving Failed
as the response even though I am able to connect to the mail server.

#!/bin/bash

telnet 192.168.0.20 25 <<EOF
quit
EOF
[ $? = 0 ] && echo "Success" || echo "Failed"

Do suggest some tips. Thanks in advance.

Regards,
-- 
Kurian Mathew Thayil.
(GPG KeyID: E232394F)

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


Reply to: