2012年3月7日 星期三

Telnet SMTP bash script


Telnet SMTP bash script
Code:
#!/bin/bash 
   ( 
        sleep 1 
        echo "ehlo x" 
        sleep 1 
        echo "mail from:frommail" 
        sleep 1 
        echo "rcpt to:tomail" 
        sleep 1 
        echo "data" 
        sleep 1 
        echo "subject:Test message" 
        sleep 1 
        echo "from:frommail 
        sleep 1 
        echo "to:tomail" 
        sleep 1 
        echo " " 
        #sleep 1 
        echo "Hello." 
        sleep 1 
        echo "This is a test message." 
        sleep 1 
        echo "Bye." 
        sleep 1 
        echo "." 
        sleep 1 
        echo "QUIT" 
   ) | telnet 172.17.7.140 25
You use netcat for this, not telnet.

Code:
[xxx@xxx src]$ nc localhost 25 << EOF
> HELO localhost
> MAIL FROM: user@whatever.com
> RCPT TO: user@whatever.com
> DATA
> this is a test
> .
> QUIT

沒有留言:

Rocky Linux 防火牆設定方法

舉例: 當有一個Nginx Keepalived的設定需求,我需要開放http和https服務,並且開放vrrp的通訊協定。 會需要完成 Keepalived 與防火牆配置 : 確定 VRRP 協定與防火牆規則均已放行: sudo firewall-cmd --permanent...