telnet收、發郵件

本文章內容:

使用telnet指令收、發郵件。

 

1. 發郵件

[root@postfix-server1 ~]# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 postfix-server1.magedu.com ESMTP Postfix
helo hihi  #helo可以換成ehlo
250 postfix-server1.magedu.com
mail from:test@aa.bb
250 2.1.0 Ok
rcpt to:user1
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
how are you?
.
250 2.0.0 Ok: queued as A2D0A10D022C
quit
221 2.0.0 Bye

2. 收郵件

提示:登入如果顯示"Connection closed by foreign host.",請參考https://wwfrandy.wordpress.com/2014/03/12/linux-dovecot-pop3-imap-%E7%95%B0%E5%B8%B8%E8%A8%8A%E6%81%AF/ 來排除異常。
[root@postfix-server1 ~]# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
+OK Dovecot ready.
USER user1
+OK
PASS user1
+OK Logged in.
LIST
+OK 1 messages:
1 412
.
RETR 1
+OK 412 octets
Return-Path: <test@aa.bb>
X-Original-To: user1
Delivered-To: user1@postfix-server1.magedu.com
Received: from hihi (localhost [127.0.0.1])
        by postfix-server1.magedu.com (Postfix) with SMTP id E792410D022D
        for <user1>; Wed, 25 Nov 2020 09:05:51 -0500 (EST)
Message-Id: <20201125140555.E792410D022D@postfix-server1.magedu.com>
Date: Wed, 25 Nov 2020 09:05:51 -0500 (EST)
From: test@aa.bb

how are you?
.
quit
+OK Logging out.
Connection closed by foreign host.