在本地使用后缀

我在Chromebook上的Linux系统上进行了与此相同的操作。
在本地环境下设置可用邮件服务器的Postfix配置。

使用的环境

$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

安装

安装后缀。

sudo apt install postfix

我們將選擇 LOCAL 作為伺服器的選擇。

需要安装Telnet来进行测试。

sudo apt install telnet

环境设置

(省略)
#
home_mailbox = Maildir/

Postfix的重新启动

sudo systemctl restart postfix

创建用户

sudo adduser -uid 1220 holiday001

考试

telnet localhost 25

我将向holiday001@penguin.lxd发送电子邮件。

$ telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 penguin.lxd ESMTP Postfix (Debian/GNU)
mail from:holiday001@penguin.lxd
250 2.1.0 Ok
rcpt to:holiday001@penguin.lxd
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Hello
.
250 2.0.0 Ok: queued as B83604FF3F
quit
221 2.0.0 Bye
Connection closed by foreign host.

确认收到邮件

sudo ls -l /home/holiday001/Maildir/new
$ sudo cat /home/holiday001/Maildir/new/1687912721.V32I4ff40M231351.penguin
Return-Path: <holiday001@penguin.lxd>
X-Original-To: holiday001@penguin.lxd
Delivered-To: holiday001@penguin.lxd
Received: from localhost (localhost [IPv6:::1])
        by penguin.lxd (Postfix) with SMTP id B83604FF3F
        for <holiday001@penguin.lxd>; Wed, 28 Jun 2023 09:38:15 +0900 (JST)
Message-Id: <20230628003825.B83604FF3F@penguin.lxd>
Date: Wed, 28 Jun 2023 09:38:15 +0900 (JST)
From: holiday001@penguin.lxd

Hello

用邮件命令进行确认

用户切换

su holiday001
$ mail
Mail version 8.1.2 01/15/2001.  Type ? for help.
"/var/mail/holiday001": 1 message 1 unread
>U  1 holiday001@pengui  Wed Jun 28 07:10   15/490   
& p
Message 1:
From holiday001@penguin.lxd  Wed Jun 28 07:10:31 2023
X-Original-To: holiday001@penguin.lxd
Date: Wed, 28 Jun 2023 07:10:17 +0900 (JST)
From: holiday001@penguin.lxd

Hello
Good Morning

& q
Saved 1 message in /home/holiday001/mbox
广告
将在 10 秒后关闭
bannerAds