Send and receive emails using postfix and Dovecot

Source: Internet
Author: User
Tags imap dovecot mx record

The Mail Application protocol includes :

    1. Simple Mail Transfer Protocol (SMTP), which is used to send or relay outgoing e-mails, consumes TCP 25 ports.
    2. The third version of the Post Office Protocol (POP3), which stores messages on the server to a local host, consumes TCP 110 ports.
    3. The fourth edition of the Internet Information Access Protocol (IMAP4), which is used to access messages on localhost, consumes TCP 143 ports.

To build an enterprise-Class e-mail system, consider the following points:

anti-spam and anti-virus modules: Prevents spam or virus messages from interfering with the corporate mailbox. Message Encryption: Ensure that the contents of the message are not sniffed or tampered with. Email Monitoring Audit: Monitor all staff e-mails with or without sensitive words, disclose enterprise information, etc. Stability: Good anti-DDoS attack ability, ensure system online rate and so on.

Deploy the basic e-mail system

  Separate use of the Postfix service program does not allow users to complete the operation of sending and receiving mail, because a basic e-mail system requires at least SMTP server, Pop3/imap server

Configure Local Host Name

[Email protected] ~]# vim/etc/hostname  mail.scott.com

Add a record and MX record

See using bind to build a DNS service

To provide a user with an e-mail system for the Scott domain , you need to add a and MX records to the DNS server first:

Modify the DNS address of this computer

cat /etc/192.168. 0.85

Configuring the Postfix service Program

To stop the iptables firewall:

The Postfix postoffice service is installed by default in Red Hat RHEL7 system:

Yum Installpostfixloaded plugins:langpacks, product-ID, subscription-Managerrhel7|4.1Kbxx:xx(1/2): Rhel7/group_gz |134Kbxx:xx(2/2): rhel7/primary_db |3.4MBxx:xx Package2:p ostfix-2.10.1-6. el7.x86_64 already installed and latest versionnothing to Do

the configuration file for the Postfix Post Office service program is as follows:

File Role
/usr/sbin/postfix Main Service Program
/etc/postfix/master.cf The configuration file for the Master Master program.
/etc/postfix/main.cf The configuration file for the Postfix service.
/var/log/maillog Logs that record the message delivery process.

1th step: View the Postfix service Program Master profile:

Edit the main configuration file of the Postfix service (modify the 5 parameters, and also need to remove the number (#) before the parameter to take effect):

[Email protected]~] # vim/etc/postfix/main.cf// Modify the postoffice hostname on line 76th. myhostname = mail.scott.com// Modify the postoffice domain name on line 83rd. mydomain = scott.com// Modify the outgoing mail domain name of line 99th, the value of $mydomain is defined above. myorigin = $mydomain// Modify the Listening network card on line 116th. inet_interfaces = all// modifies the host name and domain name of the receiving message on line 164th. mydestination = $myhostname, $mydomain

2nd step: Create a Post Office account:

[Email protected]~] # useradd Boss[[email protected]echo"123456"  passwd --forpasswd: All authentication tokens updated successfully.

3rd step: Start the Postfix service program:

[[Email protected]~] # systemctl restart Postfix[[email protected]~] # Systemctl enable Postfix LN ' /usr/lib/systemd/system/postfix.service ' ' /etc/systemd/system/multi-user.target.wants/postfix.service '

Now let's test whether postfix can send mail, as follows:

In the QQ mailbox view:

If you do not find the domain to remember to join the QQ mailbox whitelist.

Configuring the Dovecot Service Program

1th Step: Install the Dovecot service program:

Yum Install dovecot-yloaded plugins:langpacks, product-ID, subscription-1 :2.2. 43.2 for2.3. 3.4-one528 k ........... Omit part of the installation process ...... ..... Complete!

2nd Step: Modify the Dovecot program master configuration file:

[Email protected]~] # vim/etc/dovecot/dovecot.conf// Modify Support Post Office Protocol for Line 24th. protocols = IMAP POP3 LMTP// then additional allow clear text authentication (25 lines). Disable_plaintext_auth = no// modifies the address of the allowed login segment on line 48th, all allowed is (0.0.0.0/0).  192.168. 0.0/

3rd Step: Configure the format and storage path of the message. <
Edit the Dovecot configuration file (remove the comment (#号) from line 25th):

[Email protected]~] # vim/etc/dovecot/conf.d/-= mbox:~/mail:inbox=/var/mail/%u

4th step: Create the storage directory for the message:

su -login:1 onpts/  mkdir -P Mail/.imap/inbox

5th step: Start the Dovecot service program:

[[Email protected]~] # systemctl restart Dovecot[[email protected]~] # Systemctl enable Dovecot LN ' /usr/lib/systemd/system/dovecot.service ' ' /etc/systemd/system/multi-user.target.wants/dovecot.service '

Users use the Post Office system

Modify the DNS address of the client to a local DNS server address

Log in to the boss user in Foxmail

Send a message to the root user with the user

Log in to root user, check email:

[Email protected] ~]# mailheirloom Mail version12.5 7/5/Ten. Type? forHelp ......  >n7[Email protected] Thu Jan +  -: A   -/1580  "Test"N8[Email protected] Thu Jan +  -:Wuyi   $/1743  "Test Message"&8Message8: From [email protected] Thu Jan +  -:Wuyi: $  .Return-path: <[email protected]>X-original-to : [Email protected]delivered-to: [Email Protected]date:thu, +Jan .  -: Wu:xx+0800From :"[email protected]"<[email protected]>To:root<[email protected]>Subject: Test message x-priority:3X-has-Attach:nox-mailer:foxmail7,2,7, +[Cn]content-type:multipart/Alternative; Boundary="----=_001_nextpart160336538781_=----"status:rcontent-type:text/Plain; CharSet="GB2312"If you receive this email, it will be successful on behalf of the Post Office system. [Email protected]

Send and receive emails using postfix and Dovecot

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.