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

沒有留言:

AI 待觀察素材

UI UX Pro Max Design Intelligence https://www.uupm.cc/ 如何做出你的AI員工-網路版 上課簡報 https://www.4rich.org/ai/how2ai-v8.html