Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use postfix to build mail server on CentOS Linux server

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Today, I would like to share with you how to use postfix to build mail server on the CentOS Linux server. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Note: the mail server in this article is only used to send mail, that is, the stmp server.

I. preparatory work

1. Add dns resolution to the mail server

Although you can send mail without dns parsing, it will be treated as spam by most mail servers. Based on our practical experience, we need to add three dns parsing records: a record, mx record, and txt record. For example, the domain name cnblogs.info, the corresponding dns record is as follows:

two。 Prepare the hard disk space for mail

If you are using an Aliyun entry-level linux server, a 20g data disk is not mounted and needs to be formatted and mounted (assuming the directory mounted here is / data).

2. Configure postfix

Postfix is the mail server software that centos installs by default. The following configuration example assumes that the domain name to be configured is cnblogs.info and the mail server hostname is mail.cnblogs.info.

1. Open the configuration file for postfix

Vi / etc/postfix/main.cf

2.: 75 move the cursor to line 75 and modify the myhostname

Myhostname = mail.cnblogs.info

3.: 83 move the cursor to line 83 and modify mydomain

Mydomain = jb51.info

4.: 99 move the cursor to line 99 and modify myorigin

Myorigin = $mydomain

Move the cursor to line 116 and modify the inet_interfaces

Inet_interfaces = all

6.: 119 move the cursor to line 119 and modify inet_protocols

Inet_protocols = ipv4

7.: 164move the cursor to line 164 and add $mydomain

Mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

8.: 264 move the cursor to line 264 and modify the mynetworks

Mynetworks = 127.0.0.0amp 8

Subnet Mask (netmask) converter: network and ip address calculator

9.: 419 move the cursor to line 419 and set home_mailbox

Home_mailbox = maildir/

10.: 425 move the cursor to line 425, set mail_spool_directory,/data to the previously mounted data disk, and the mail directory needs to be created through the mkdir command

Mail_spool_directory = / data/mail

11. Restart postfix for the settings to take effect

Service postfix restart

Third, use telnet to test whether the mail server is normal

1. Install telnet on the mail server

Yum install telnet

two。 Connect to the server smtp port

Telnet 127.0.0.1 25

3. Fill in the sender

Mail from:test@jb51.info

Enter

4. Fill in the recipient

Rcpt to:contact@jb51.net

Enter

5. Write the content of the email

5.1 start writing email content

Data

Enter

5.2 enter title

Subject: test message

Enter

5.3 enter the content and use. End of number

Test body.

If the following message is displayed, the message enters the sending queue

250 2.0.0 ok: queued as 88d6d32a94

Authorize other servers to send mail through this mail server

Without authorization, if you telnet this server on another server, a relay access denied error will occur after entering the recipient

Rcpt to:contact@jb51.net554 5.7.1: relay access denied

Solution:

Vi / etc/postfix/main.cf,:264 move the cursor to line 264 and add the server ip address after the value of mynetworks, such as:

Mynetworks = 127.0.0.0amp 8 58.33.14.124

After service postfix restart, the problem is resolved.

V. other issues

When you receive the email from telnet above, you will find that the recipient information shows undisclosed recipients. The solution is to enter the following message after the data command and before typing subject:

From:test@jb51.infoto:contact@jb51.net above is all the contents of the article "how to use postfix to build a mail server on a CentOS Linux server". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report