LNMP one-click package is my most commonly used environment configuration method. More people use it, and it is easier to use Baidu when encountering problems. By default, LNMP installs the sendmail component for sending letters, but sendmail sending is indeed very slow, especially when installing domestic VPS. I have tried Alibaba, Tencent, and Jing'an, but it is really very slow (I don't know why...) , so it is recommended to install Postfix, which is much faster than sendmail.
Postfix
The host operating system involved in this record is CentOS, and the installation environment is Junge LNMP one-click package.
1. Uninstall sendmail

1
yum remove sendmail

2. Install Postfix

1
yum install postfix

3. Change the default MTA to Postfix

1
/usr/sbin/alternatives --set mta /usr/sbin/sendmail.postfix

4. Check whether the change is successful

1
alternatives --display mta

5. Configure Postfix

1
vi /etc/postfix/main.cf

After opening, find the following items respectively. Note that these items are not in the same location. Find them one by one and modify them. Remove the # in front of them and configure them:

1
2
3
4
5
6
7
8
myhostname = mail.zrblog.net
mydomain = zrblog.net
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 192.168.100.10/24, 127.0.0.0/8
relay_domains =
home_mailbox = Maildir/

Configuration file explanation:
mydomain:
The mydomain parameter refers to the domain name of the email server. Please ensure that it is a formal domain name (such as zrblog.net).
myhostname:
The myhostname parameter refers to the host name of the system (such as My server host name is mail.zrblog.net)
myorigin:
The myorigin parameter specifies the domain name displayed in the source and delivery of locally sent emails. In our example, mydomain is zrblog.net, which is also my domain name.
For the line below, our email address is [email protected] not [email protected].
myorigin = $mydomain
mynetworks:
The mynetworks parameter specifies a list of trusted SMTP clients. Specifically, trusted SMTP clients are allowed to deliver mail through Postfix.
mydestination:
The mydestination parameter specifies which email addresses are allowed to send emails locally. This is a set of trusted IP addresses that are allowed to send or deliver email through the server. Users attempting to send mail from origin servers with IP addresses not listed here will be rejected.
inet_interfaces:
The inet_interfaces parameter sets the network interface so that Postfix can receive mail.
relay_domains:
This parameter is the list of destination domain names for the system to deliver emails. If left blank, we ensure that our mail server is not open to untrusted networks.
home_mailbox:
This parameter sets the mailbox path related to the user directory. You can also specify the mailbox style to be used.
6. Start Postfix

1
2
3
4
[[email protected] ~]# service postfix status   #Check status
master is stopped
[[email protected] ~]# service postfix start     #Start
Starting postfix:       < x2>                                 <x2 > [  OK  ]

7. Set up startup

1
chkconfig postfix on

8. Add parsing records to avoid spam
Add an A record for mail, an MX record for @ and a TXT record to prevent emails from entering the recipient's trash can directly.
Reference link for this article: http://www.gongzi.org/centos-install-postfix-sendmail.html

Tags: LNMP installation Postfix, Postfix, sendmail is slow to send emails

window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":["mshare","kaixin001","tsina"," tsohu","tqq","renren","qzone","weixin","bdysc","bdxc","tqf","tieba","douban","bdhome","sqq","thx" ],"bdPic":"","bdStyle":"0","bdSize":"24"},"slide":{"type":"slide","bdImg":"2","bdPos" :"left","bdTop":"100"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["tsina","tqq","tsohu","qzone","renren", "weixin","mshare"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg .share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
postid
21945

Leave a Reply