這個 script 是使用 expect 作的,也需要 telnet 指令

基本上就是用 telnet 驗證有沒有這樣子而已

編輯 check_email_verify.exp 檔,內容如下

#!/usr/bin/expect
#
# 檢查 email 存不存在
# need expect and telnet command
#
set timeout 60
set mx [lindex $argv 0]
set em [lindex $argv 1]
spawn telnet $mx 25
expect "220"
send "EHLO $mx\n"
expect "250 "
send "MAIL FROM: <$em>\n"
send "RCPT TO: <$em>\n"
expect -re "450|550|2.1.5|ecipient.*ok"
send "QUIT\n"

執行如下指令

                              mailserver    帳號
expect check_email_verify.exp mail.ssorc.tw cross@ssorc.tw

成功的話就會是這樣子

spawn telnet mail.ssorc.tw 25
Trying xx.xx.xx.xx...
Connected to mail.ssorc.tw.
Escape character is '^]'.
220 XXXXXXXXX
EHLO mail.ssorc.tw
250-XXXXXXXXX Hello [xx.xx.xx.xx]
250-SIZE
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-X-ANONYMOUSTLS
250-AUTH NTLM
250-X-EXPS GSSAPI NTLM
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-XEXCH50
250-XRDST
250 XSHADOW
MAIL FROM: <cross@ssorc.tw>
RCPT TO: <cross@ssorc.tw>
250 2.1.0 Sender OK
250 2.1.5 Recipient OK

有找到一個網頁 http://verify-email.org/ 也可以作這種事

MX record about ssorc.tw exists.
Connection succeeded to mail.ssorc.tw SMTP.
220 XXXXXXXXX
> HELO verify-email.org 
250 ssorc.tw Hello [verify-email.org]
> MAIL FROM: <check@verify-email.org>
=250 2.1.0 Sender OK
> RCPT TO: <cross@ssorc.tw>
=250 2.1.5 Recipient OK

 

 

Related posts 相關文章
Windows Powershell Test-NetConnection 指令測試與遠端主機的連線
More...
nc 指令檢查 UDP port 是否活著
More...
SMTP 測試工具 swaks – Swiss Army Knife for SMTP
More...
用 telnet 測試郵件帳密及支援的認證方式
More...

作者

留言

Hi! Try Zerobounce.net for email validation. They are the most secure and accurate email validation system you can find. Here is the link where you can find them https://www.zerobounce.net

你好,我是一個完全不懂語言的人, 但由於公司發信需要驗證出email是否有效, 想請問如何測試? 因為我連這段語言我都不知道要打在哪裡, 麻煩您了

    作者

    我補充了文章,你再試試,如果還不是行,可以試文章下面提到的線上版的

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。