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 build a mail server with Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge of this article "how to build a mail server in Linux", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to build a mail server in Linux" article.

The mail server is a device used to manage the sending and receiving of e-mail. It is more secure and efficient than free mailboxes on the Internet.

Step 1 of setting up a mail server with Linux. Install and configure postfix and dovecot services

Turn off the firewall and selinux and start installing postfix and dovecot yum install postfix dovecot-y to set the host name and domain name

[root@mail ~] # hostnamectl set-hostname mail.wq.com [root@mail ~] # echo '192.168.0.155 mail.wq.com' > / etc/hosts 12 set DNS Service vi / var/named/wq.com.zone

$TTL 1D @ IN SOA ns.wq.com. Root.wq.com. (0; serial 1D; refresh 1H; retry 1W; expire 3H); minimum NS ns.wq.com. MX 5 mail.wq.com. Ns A 192.168.0.155 mail A 192.168.0.155 smtp CNAME mail pop3 CNAME mail www CNAME mail 1234567891011121314 [root@mail ~] # host-n-t mx wq.com 192.168.0.155

Using domain server: Name: 192.168.0.155 Address: 192.168.0.155#53 Aliases: wq.com mail is handled by 5 mxbiz1.qq.com. Wq.com mail is handled by 10 mxbiz2.qq.com. 12345672. Basic configuration, edit main configuration file

[root@mail ~] # cp / etc/postfix/main.cf / etc/postfix/main.cf.bak vi / etc/postfix/main.cf / / modify the following parameters

* myhostname* / / hostname myhostname = mail.wq.com * mydomain* / / use the mail domain mydomain = wq.com / / set the mail domain of the local network * myorigin* / / the sender's mail domain myorigin = $mydomain inet_interfaces = all / / set the network port mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain / / to be listened to by postfix. Set the host name or domain name that can receive mail. Messages from other hostnames or domain names will be refused to receive the address of the * mynetworks* / / transceiver client mynetworks = 192.168.0.0Mab 24, 127.0.0.0lap8 / / specifies the IP segment of the local network, and only the host itself is included by default. Relay_domains = $mydestination / / set the domain name or host name from which mail can be forwarded home_mailbox = Maildir/ location of mail storage 12345678910111213141516171819 set up to enable the service systenctl start postfix

Create a user account useradd zs echo '123456' | passwd-stdin zs useradd ls echo' 123456' | passwd-stdin ls uses the telnet tool to send mail to test yum install telnet-y

[root@mail ~] # telnet localhost 25

Trying:: 1... Connected to localhost. Escape character is'^]'. 220 mail.wq.com ESMTP Postfix HELO localhost / / announce customer address 250 mail.wq.com MAIL FROM:zs@wq.com / / Sender address 250 2.1.0 Ok RCPT TO:ls@wq.com / / recipient address 250 2.1.5 Ok DATA / / transmit data content 354 End data with. Subject:test mail / / theme hello! This is test mail. / / the last point indicates the end of 2502.0.0 Ok: queued as 508F0104FA00 quit / / exit 221.0.0 Bye Connection closed by foreign host. 1234567891011121314151617181920 check email [root@mail ~] # ls/ home/ls/Maildir/new/ 1544098321.Vfd00I3839584M985672.mail.wq.com

3. Configure the pickup server dovecot

Yum install dovecot-y edit the main configuration file [root@mail ~] # vi / etc/dovecot/dovecot.conf / / modify the following

Protocols = imap pop3 lmtp / / 20 line: specify the negotiation listen running by this mail host = * / / 26 line: monitor all network interfaces of this machine login_trusted_networks = 192.168.95.0 shock line 24 / / 38: specify the address of the network segment allowed to log in 12345 [root@mail ~] # vim / etc/dovecot/conf.d/10-mail.conf

/ / find the following configuration line (line 24) and remove the first line "#" mail_location = maildir:~/Maildir / / specify mail storage format and location 12 restart service systemctl start dovecot acceptance test [root@mail ~] # telnet localhost 110

Trying:: 1... Connected to localhost. Escape character is'^]'. + OK Dovecot ready. User ls / / user + OK pass 123456 password + OK Logged in. List / / check email + OK 3 messages: 1 381 2 1561 3 401. Retr 1 / View the first letter + OK 381octets Return-Path: X-Original-To: ls@wq.com Delivered-To: ls@wq.com Received: from localhost (localhost [IPv6:::1]) by mail.wq.com (Postfix) with SMTP id 1D391104FA01 for; Thu, 6 Dec 2018 04:38:13-0500 (EST) Subject:test mail Message-Id: Date: Thu, 6 Dec 2018 04:38:13-0500 (EST) From: zs@wq.com HELLo. Quit + OK Logging out. Connection closed by foreign host. 12345678910111213141516171819202122232425262728293031324. Use the windows client to test and download Foxmail. First test whether the host can ping. If not, turn off the windows firewall or bind the domain name to IP in windows, and write 192.168.0.155 mail.wq.com to add email account on disk c: / windows/drivers/system32/etc/hosts.

Send an email

You can view email messages by synchronizing in linux

The test is complete.

The above is about the content of this article on "how to build a mail server in Linux". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow 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

Development

Wechat

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

12
Report