Aliyun CentOS How to use Postfix to build a mail server on Linux servers

Source: Internet
Author: User
Tags mail centos mx record aliyun linux

Note: This article's mail server is used only to send mail, that is, the STMP server.

First, preparatory work

1. Add DNS resolution for mail server

Although you can send a message without DNS resolution, it will be treated as spam by most mail servers. According to our practical experience, we need to add three DNS resolution records: A record, MX record, txt record. For example domain name cnblogs.info, the corresponding DNS record is as follows:

2. Prepare the hard disk space to store the mail

If you are using the Aliyun entry-level Linux server, there is a 20G of data disk is not mounted, you need to format and mount (assuming that the directory is mounted here is/data), the specific steps see before the Bovenari server hard disk partition and mount.

Second, configure Postfix

Postfix is the CentOS mail server software that is installed by default. The following configuration example assumes that the domain name to be configured is Cnblogs.info and the mail server host name is Mail.cnblogs.info.

1. Open the Postfix configuration file

Vi/etc/postfix/main.cf

2.: 75 cursor moved to line 75th, modify Myhostname

Myhostname = Mail.cnblogs.info

3.: 83 cursor moved to line 83rd, modify MyDomain

MyDomain = Cnblogs.info

4.: 99 cursor moved to line 99th, modify Myorigin

Myorigin = $mydomain

5.: 116 cursor moved to line 116th, modify Inet_interfaces

Inet_interfaces = All

6.: 119 cursor moved to line 119th, modify Inet_protocols

Inet_protocols = IPv4

7.: 164 The cursor moves to line 164th, add $mydomain

mydestination = $myhostname, localhost $mydomain, localhost, $mydomain

8.: 264 cursor moved to line No. 264, modify Mynetworks

Mynetworks = 127.0.0.0/8

Subnet mask (netmask) Converter: Network and IP address calculator

9.: 419 cursor to move to line No. 419, set Home_mailbox

Home_mailbox = maildir/

10.: 425 the cursor moves to line No. 425, setting Mail_spool_directory,/data is the previously mounted data disk, the mail directory needs to be created by the mkdir command

Mail_spool_directory =/data/mail

11. Reboot postfix to make setting effective

Service Postfix Restart

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.