CentOS 7系統配置exim發郵件伺服器教程

來源:互聯網
上載者:User


1. 配置epel源(exim包位於EPEL軟體源中)
CentOS7

# cat > /etc/yum.repos.d/epel.repo << EOF
[epel]
name=Extra Packages for Enterprise Linux 7 - \$basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch
failovermethod=priority
enabled=1
gpgcheck=0
EOF
CentOS6

# cat > /etc/yum.repos.d/epel.repo << EOF
[epel]
name=Extra Packages for Enterprise Linux 6 - \$basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=\$basearch
failovermethod=priority
enabled=1
gpgcheck=0
EOF
2. 禁止postfix

# service postfix stop
# chkconfig postfix off
3. 安裝exim

# yum -y install exim
4. 將exim設為預設的MTA

# alternatives --set mta /usr/sbin/sendmail.exim
5. 修改exim設定檔
# vi /etc/exim/exim.conf #幾個參數

primary_hostname = mail.linuxeye.com #查看源郵件時顯示Received: from mail.linuxeye.com,如果不指定直接取作業系統的hostname
domainlist local_domains = @ localhost : localhost.localdomain :mail.linuxeye.com
domainlist relay_to_domains = linuxeye.com #允許通過改主機發送郵件的網域名稱
hostlist   relay_from_hosts = 127.0.0.1 : 192_32G : 192.168.0.0/16 : #允許那些用戶端主機發送郵件,如本地使用這台伺服器發送郵件時,即需要添加本地出口ip地址(公網地址)
6. 測試

# yum -y install mailx
# date | mail -r no-reply@linuxeye.com -s 'exim test' lj2007331@163.com
# tail -f /var/log/exim/main.log #exim記錄檔
ps:
如果不指定-r(發郵件地址),且你的主機名稱不是xxx.com,可能會報如下錯誤:
SMTP error from remote mail server after MAIL FROM:
錯誤是550 MI:IMF 發信人電子郵件地址不合規範

經驗:
強烈建議用網易企業郵箱,如果自己搭建郵件伺服器做發郵件,又設定QQ企業郵箱做本地收發伺服器會出現地址未驗證問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.