1. 程式人生 > >ubuntu 14.04 安裝postfix服務

ubuntu 14.04 安裝postfix服務

一、安裝postfix

# When asked about the environment, select 'Internet Site'. When asked to confirm the hostname
sudo apt-get install postfix
sudo apt-get install mailutils

二、新增郵件使用者賬號

sudo useradd -m -s /bin/bash incoming
sudo passwd incoming

三、測試郵件服務

  • 連結SMTP服務
telnet localhost 25
  • 傳送郵件給incoming使用者
ehlo localhost
mail from: [email protected]
rcpt to: [email protected]
data
Subject: Re: Some issue

Sounds good!
.
quit
  • 登陸incoming使用者,檢視郵件
su - incoming
mail
"/var/mail/incoming": 1 message 1 unread
>U   1 [email protected]                           59/2842  Re: Some issue

四、配置 Postfix使用Maildir-style方式

sudo postconf -e "home_mailbox = Maildir/"
sudo /etc/init.d/postfix restart
  • incoming使用者配置使用Maildir ,重新發送郵件給incoming使用者
su - incoming
mkdir /home/incoming/Maildir
MAIL=/home/incoming/Maildir
mail
exit
sudo service postfix restart

五、參考