2018/2/5

sendmail : mail to self with broken config

只是為了在自己機器上的測試...
apt-get install 完 sendmail 後,什麼都沒設...

用 telnet 連接 mail service port: 25
因為沒有設定好主機名稱(沒有 dns),所以 sendmail 只認識 localhost
darling@franxx:/var/log$ telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 franxx ESMTP Sendmail 8.15.2/8.15.2/Debian-3; Mon, 5 Feb 2018 10:26:17 +0800; 
(No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
HELO localhost
250 franxx Hello localhost [127.0.0.1], pleased to meet you
MAIL FROM : darling@localhost
250 2.1.0 darling@localhost... Sender ok
RCPT TO : darling@localhost
250 2.1.5 darling@localhost... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
this is the mail
and more
.
250 2.0.0 w152QHi9022136 Message accepted for delivery
quit
221 2.0.0 franxx closing connection
Connection closed by foreign host.
You have new mail in /var/mail/darling
darling@franxx:/var/log$ mail -p
Return-Path: 
Received: from localhost (localhost [127.0.0.1])
 by franxx (8.15.2/8.15.2/Debian-3) with SMTP id w152QHi9022136
 for darling@localhost; Mon, 5 Feb 2018 10:27:03 +0800
Date: Mon, 5 Feb 2018 10:26:17 +0800
From: darling 
Message-Id: <201802050227.w152QHi9022136@franxx>

this is the mail
and more
命令說明:
  • 先要用 HELO 說明自己主機名稱,因為 sendmail 可以同時服務很多主機名撐。
  • MAIL FROM : 寄信人。
  • RCPT TO : 收信人
  • DATA 信件內容,用 "." 符號結束。
對於沒有限制 sender 跟檢查的 mail server,這樣的設定也可以寄。(gmail 就不行)
就是 RCPT TO 寫對方 emai address 就可以,

ref:https://ubuntuforums.org/showthread.php?t=1819158"

沒有留言:

張貼留言