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 mail server dovecot in Linux server

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

What this article shares to you is about how to use the mail server dovecot in the Linux server. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Install dovecot

Dovecot is a famous POP3/IMAP server implementation in CentOS system. POP3/IMAP is the protocol used when reading mail from the mail server. POP3 drags all the messages from the server, while IMAP gets key information such as the mail name from the server every time, and downloads it from the server only when you want to read a message.

Before using the mail service, please make sure that the DNS you configured earlier is available and started. We need to use the email domain name resolution in the DNS configuration.

1. Install dovecot

[root@localhost ~] # rpm-qa | grep dovecot

[root@localhost ~] # yum install-y dovecot

Installed:

Dovecot.i686 1RO 2.0.9-22.el6

Complete!

[root@localhost ~] #

2. Modify the configuration file "/ etc/dovecot/dovecot.conf" to enable the dovecot function

[root@localhost ~] # gedit / etc/dovecot/dovecot.conf

Protocols = imap pop3 lmtp / / this line is commented by default and must be uncommented. This indicates that the imap pop3 lmtp protocol is enabled

Listen=* / / listens on all ipv4 interfaces

Login_trusted_networks = 192.168.0.0amp 24 / / the network segment where login is allowed

3. Set the storage path of the mail. Modify the configuration file "/ etc/dovecot/conf.d/10-mail.conf", parameter mail_location

[root@localhost pub] # gedit / etc/dovecot/conf.d/10-mail.conf

# mbox is an internal mailbox and is owned by dovecot. In general, the IMAP protocol supports multiple mailboxes, so the contents of other mailboxes are stored in / var/mail/%u

Mail_location = mbox:~/mail:INBOX=/var/mail/%u

4. create a mail storage directory. The mail storage path has been configured above, but this directory needs to be created by the user, so we will create a mail directory for the user david. Note that every user in the system can be treated as a mail user

[root@localhost ~] # su david / / switch to david

[david@localhost root] $cd / home/david/ Jump to home directory

[david@localhost ~] $mkdir-p mail/.imap/INBOX / / create a mail directory

5. Set up the firewall. Imap uses port 143and pop3 uses port 110. open these two ports of tcp in the firewall.

[root@localhost ~] # gedit / etc/sysconfig/iptables

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 110-j ACCEPT

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 143j ACCEPT

[root@localhost ~] # service iptables restart

Iptables: set chain to policy ACCEPT:filter nat [OK]

Iptables: clear firewall rules: [OK]

Iptables: uninstalling module: [OK]

Iptables: apply firewall rules: [OK]

Iptables: load additional modules: nf_conntrack_ftp [OK]

6. Start the service

[root@localhost ~] # service dovecot start

Starting Dovecot Imap: [OK]

[root@localhost ~] #

7. Check whether ports 110 and 143 are running

[root@localhost ~] # netstat-tunlp | grep 110

Tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 00

Tcp 0 0: 110: * LISTEN 2650/dovecot

[root@localhost ~] # netstat-tunlp | grep 143

Tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 14. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0

Tcp 0 0: 143: * LISTEN 2650/dovecot

8. Log in to the mailbox on the command line

[root@localhost ~] # telnet 192.168.0.113143 / / ip is the server address, and 143is the port of imap

Trying 192.168.0.113...

Connected to 192.168.0.113.

Escape character is'^]'.

* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN] Dovecot ready. / / it means you can connect here.

A login david 543092 / / this is the login operation, username david, password 543092. This command requires user input

An OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS] Logged in / / Login succeeded

The above is how to use the mail server dovecot in the Linux server. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, 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

Servers

Wechat

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

12
Report