$ sudo service postfix restart $ sudo service dovecot restart
现在让我们使用老朋友 telnet 来看下 Dovecot 是否设置正确。
1 2 3 4 5 6 7 8 9 10 11 12 13
$ telnet studio 110 Trying 127.0.1.1... Connected to studio. Escape character is '^]'. +OK Dovecot ready. user molly@studio +OK pass password +OK Logged in. quit +OK Logging out. Connection closed by foreign host.
现在一切都好!让我们用 mail 命令,发送测试消息给我们的用户。确保使用用户的完整电子邮箱地址而不只是用户名。
1 2 3 4 5
$ mail benny@studio Subject: hello and welcome! Please enjoy your new mail account! .
最后一行的英文句点表示发送消息。让我们看下它是否到达了正确的邮箱。
1 2 3 4 5 6
$ sudo ls -al /home/vmail/studio/benny@studio/.Mail/new total 16 drwx------ 2 vmail vmail 4096 Dec 14 12:39 . drwx------ 5 vmail vmail 4096 Dec 14 12:39 .. -rw------- 1 vmail vmail 525 Dec 14 12:39 1481747995.M696591P5790.studio,S=525,W=540
找到了。这是一封我们可以阅读的纯文本文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
$ less 1481747995.M696591P5790.studio,S=525,W=540 Return-Path: <carla@localhost> Delivered-To: benny@studio Received: from localhost by studio (Dovecot) with LMTP id V01ZKRuuUVieFgAABiesew for<benny@studio>; Wed, 14Dec201612:39:55-0800 Received: by localhost (Postfix, from userid 1000) id 9FD9CA1F58; Wed, 14Dec201612:39:55-0800 (PST) Date: Wed, 14Dec201612:39:55-0800 To: benny@studio Subject: hello and welcome! User-Agent: s-nail v14.8.6 Message-Id: <20161214203955.9FD9CA1F58@localhost> From: carla@localhost (carla)