在阿里雲上部署 Postfix


Postfix 可以很方便的在一台機器上部署 smtp 服務,在 centos 上來說的話可以使用:

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

 

可以通過訪問 cd /etc/postfix/ 查看配置下面有些什么東西:

[root@iZ2ze9mbirr18cl7fb5ewtZ postfix]# ls
access  canonical  generic  header_checks  main.cf  master.cf  relocated  transport  virtual

 

主要需要去配置一下 main.cf 我們需要關注:

# The myhostname parameter specifies the internet hostname of this
# mail system. The default is to use the fully-qualified domain name
# from gethostname(). $myhostname is used as a default value for many
# other configuration parameters.
#
myhostname = mail.hundun.cn
#myhostname = virtual.domain.tld

這里配置 hostname 需要配下另外還需要配置一下主域名:

# The mydomain parameter specifies the local internet domain name.
# The default is to use $myhostname minus the first component.
# $mydomain is used as a default value for many other configuration
# parameters.
#
#mydomain = domain.tld
mydomain = hundun.cn

 

將接收的網絡郵件改為

# The inet_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on.  By default,
# the software claims all active interfaces on the machine. The
# parameter also controls delivery of mail to user@[ip.address].
#
# See also the proxy_interfaces parameter, for network addresses that
# are forwarded to us via a proxy or network address translator.
#
# Note: you need to stop/start Postfix when this parameter changes.
#
inet_interfaces = all

 

之后就可以了, start restart 一把。 我們在 cenos7 下可以使用 systemctl status postfix 查看 postfix 目前的情況。

如果我們是將這個服務部署在 aliyun 上的話就會面臨另外一個問題,就是 aliyun 目前默認會封鎖 smtp 的 25 號郵件端口,這樣的話及時我們配置好了

也無法讓郵件發送到公網,所以我們需要去 aliyun 申請域名下的 25 號端口解封。申請好就可以了。

另外我們可以去 domain server 上配置 dns mx 解析,讓我們的郵件服務器地址能被 dns 正確的解析到正確的域下面,這樣會減少郵件進垃圾郵件的風險。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM