一、安装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: root@localhost rcpt to: incoming@localhost data Subject: Re: Some issue Sounds good! . quit 登陆incoming用户,查看邮件 su - incoming mail "/var/mail/incoming": 1 message 1 unread >U 1 root@localhost 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 五、参考 gitlab配置邮件服务