I am creating a script to test an email by HELO ..
Directly in telnet console, the commands run fine, but in a script, I can not get the output.
In bash:
$ telnet alt1.aspmx.l.google.com 25
HELO verify-email.org
MAIL FROM: <check@verify-email.org>
RCPT TO: <test@gmail.com>
quit
results in:
root@san [~]# telnet alt1.aspmx.l.google.com 25
Trying 2a00:1450:4010:c09::1a...
Connected to alt1.aspmx.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP qm6si6508388lbb.110 - gsmtp
HELO verify-email.org
250 mx.google.com at your service
MAIL FROM: <check@verify-email.org>
250 2.1.0 OK qm6si6508388lbb.110 - gsmtp
RCPT TO: <test@gmail.com>
550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 https://support.google.com/mail/answer/6596 qm6si6508388lbb.110 - gsmtp
quit
221 2.0.0 closing connection qm6si6508388lbb.110 - gsmtp
Connection closed by foreign host.
In a script:
cat << EOF | telnet alt1.aspmx.l.google.com 25
HELO verify-email.org
MAIL FROM: <check@verify-email.org>
RCPT TO: <test@gmail.com>
quit
EOF
OR
{ echo "HELO verify-email.org"; sleep 1; echo "MAIL FROM: <check@verify-email.org>"; sleep 1; echo "RCPT TO: <test@gmail.com>" ; sleep 1 ; echo quit } | telnet alt1.aspmx.l.google.com 25
OR
#!/usr/bin/expect -f
spawn alt1.aspmx.l.google.com 25
send '"HELO verify-email.org\r"'
send '"MAIL FROM: <check@verify-email.org>\r"'
send '"RCPT TO: <test@gmail.com>\r"'
send '"quit\r"'
OR
sh aa 1> aa.txt 2>&1
OR
sh aa &> aa.txt
brings no results.