CentOS 6、7下配置exim發郵件伺服器

來源:互聯網
上載者:User

CentOS 6、7下配置exim發郵件伺服器
1.配置epel源(exim包位於EPEL軟體源中)

CentOS7

  1. #cat>/etc/yum.repos.d/epel.repo<<EOF[epel]name=ExtraPackagesforEnterpriseLinux7-\$basearch#baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearchmirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearchfailovermethod=priorityenabled=1gpgcheck=0EOF

CentOS6

  1. #cat>/etc/yum.repos.d/epel.repo<<EOF[epel]name=ExtraPackagesforEnterpriseLinux6-\$basearch#baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearchmirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=\$basearchfailovermethod=priorityenabled=1gpgcheck=0EOF
2. 禁止postfix
  1. #servicepostfixstop

  2. #chkconfigpostfixoff

3. 安裝exim
  1. #yum-yinstallexim

4. 將exim設為預設的MTA
  1. #alternatives--setmta/usr/sbin/sendmail.exim

5. 修改exim設定檔
  1. #vi/etc/exim/exim.conf#幾個參數primary_hostname=mail.flying.com#查看源郵件時顯示Received:frommail.flying.com,如果不指定直接取作業系統的hostnamedomainlistlocal_domains=@localhost:localhost.localdomain:mail.flying.comdomainlistrelay_to_domains=flying.com#允許通過改主機發送郵件的網域名稱hostlistrelay_from_hosts=127.0.0.1:192_32G:10.168.0.0/16:
  2. <br>
  3. #允許那些用戶端主機發送郵件,如本地使用這台伺服器發送郵件時,即需要添加本地出口ip地址(公網地址)

6. 測試
  1. #yum-yinstallmailx

  2. #date|mail-rno-reply@flying.com-s'eximtest'uttflying@foxmail.com

  3. #tail-f/var/log/exim/main.log#exim記錄檔

ps:

如果不指定-r(發郵件地址),且你的主機名稱不是xxx.com,可能會報如下錯誤:

SMTP error from remote mail server after MAIL FROM:

錯誤是550 MI:IMF 發信人電子郵件地址不合規範

使用檔案進行郵件發送:

date|mail-rflying@yflying.com-s'SN_IPinfoTEXT'uttflying@163.comwanglei@flying.com</root/cobbler/sn.logmail命令的文法如下:Usage:mail[-iInv][-ssubject][-ccc-addr][-bbcc-addr]to-addr...[--sendmail-options...]mail[-iInNv]-f[name]mail[-iInNv][-uuser]

測試成功

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.