Linux mail server

Source: Internet
Author: User
Tags auth imap all mail dovecot mail account mozilla thunderbird server port microsoft outlook

e-mail communication system protocols and concepts:
Software roles:
MUA: Mail client
MTA: Mail Service side
MDA: Mail server-side module
Mail client: Mail user agent
Mail server: Mail Transfer agent, message transfer agents
module/function on mail server: Mail Delivery agent, message Distribution Agents

Send, Post mail--postfix
Receive mail--dovecot

Communication protocols and processes:
Communication rules for both sides of the message delivery
SMTP: Simple Mail Transfer Protocol (TCP25)
POP3: Offline Trust Agreement, Third Edition Mail Protocol (TCP110)
IMAP4: Online Management letter Agreement, Fourth edition Internet Message Access Protocol (TCP143)
Sender-smtp-"mta-smtp-" Mta-pop3/imap-mua

Common mail Server Software
Compatible with SendMail, modular design
Excellent delivery efficiency, stability, performance and safety
Microsoft products, easy to integrate with Windows products, good collaboration
Other Open source MTA software
Qmail Sendmail

Mail client Software
Command-line tools
Telnet Mail server port
Mail Mutt
Graphics Transceiver Software Tools
Microsoft Outlook
Tencent Foxmail
Mozilla Thunderbird (Thunderbird)


Mail system composition
Sending service + receiving service + client Tools

Mail servers: Mail.
Mail domain: @Anonymous. cn
Mail account: Local System user of the server
Main software
Sending service: Postfix
Receiving Service: Dovecot
MX (mail exxchange message exchange record)
[[email protected] ~]# Useradd x (Create two users)
[Email protected] ~]# useradd XX

[Email protected] named]# vim/etc/named.conf
Options {
Directory "/var/named";
Zone "" {
Type master;
File "";

[Email protected] named]# vim
@ MX Ten mail. (@ The FQDN of the MX Priority Mail server)
Mail A (mail server address)
[[Email protected]]# service named restart

Sending service: Postfix:
The Redhat6,postfix has been installed by default, but the listening address is
Related directories and configuration files
configuration file, stored under/etc/postfix/
Service configuration:/ETC/POSTFIX/MAIN.CF
Main program configuration:/ETC/POSTFIX/MASTER.CF
Management program, stored under/usr/sbin/

Mail Communication log (Error-based):
Mail Queue directory,/var/spool/postfix subdirectories

Postconf: View the currently active configuration (all items that can be set)
postconf-d: View all default configurations (all items that can be set)
Postconf-n: List only modified configurations (not default)
Postconf-e ' inet_interfaces = All ' (direct election)
[Email protected] postfix]# postconf

Service interface and domain settings:
Basic configuration Parameters
Inet_interfaces: The interface address of the listening service
Myhostname: Server Host Name
MyDomain: Primary mail domain
Myorigin: Outgoing mail when sending mail domain address
Mydestination: The recipient domain that can be delivered locally

Mailbox Type and Location:
Mailbox type
MBOX: One mailbox file per user, with all mail messages, less efficient when the message content is large
--"Traditional mailbox:/var/spool/mail/user Name
Maildir: Each user A mailbox directory, each message corresponding to a separate file, access speed and efficiency better, to manage the content of the message more convenient
Home_mailbox: Mailbox Location and type
[Email protected] postfix]# vim MAIN.CF
Home_mailbox = Maildir (with Maildir mailbox type)
Ps: Where Maildir represents the mailbox name and is placed in the user's host directory, it is automatically created when the first message is received.
The end of/indicates that this mailbox is a directory (non-mailbox mode)

Thin configuration file
[[email protected] postfix]# CP Main.bak (for security purposes, back up the default configuration file)
[[Email protected] postfix]# mv A.txt (overwrite the original profile)
MV: Do you want to overwrite ""? Y (y)
[[email protected] postfix]# vim (Modify MAIN.CF)
Inet_interfaces = All (open)
MyDomain = (primary mail domain)
myhostname = mail. $mydomain ($mydomain variable, equivalent to mail.
Myorigin = $mydomain
Mydestination = $mydomain, $myhostname, localhost. $mydomain, localhost (plus $mydomain variable)
Home_mailbox = maildir/
[[Email protected] ~]# service postfix Restart (after configuration, restart services)

MUA client Software
Mail command: No configuration required, directly on this computer as a mail server
As long as you do the necessary configuration, you can use another host as your mail server
Mail usage:
Message: Mail-s ' title '-R Sender address recipient address
echo ' File ' | Mial-s ' title '-R Sender address recipient address
Mial-s ' title '-R Sender Address recipient address < file directory/file

[Email protected] ~]# mail-s ' Hydra '-R [email protected] [email protected] (instance)
Hail hydra!! (Ctrl+d sent after writing)

[Email protected] ~]# echo ' Hail Hydra ' |mail-s ' Hydra '-R [email protected] [email protected] (pipeline send)

[[email protected] ~]# mail-s ' Hydra '-R [email protected] [email protected] </etc/passwd (mail content more, you can first write the message in a file, with < ; REDIRECT input)

[[email protected] ~]# ls ~x/(home directory into x)
[[email protected] ~]# ls ~x/maildir/
[[email protected] ~]# ls ~x/maildir/new/
1499966759, new mail is placed.
[[email protected] ~]# cat ~x/maildir/new/1499966759. (View message content)
Return-path: <[email protected]>
X-original-to: [Email  protected]
Delivered-to: [email protected]
Received:by Mail. (Postfix, from UserID 0)
ID 16df618061e; Fri, 01:25:58 +0800 (CST)
Date:fri, 01:25:58 +0800
to: [email protected]
Subject:h Ydra
User-agent:heirloom mailx 12.4 7/29/08
Content-type:text/plain; charset=us-ascii
Message-id: <[email protected]>
from: [email protected] (Root)

C/S architecture
From the mail server this machine to send letters, receive mail
mail--on the SVR6, SVR6 on the Postfi
SVR6 on the mail--"SVR6 on the mailbox directory
From the client to receive the letter (using the newly built mail server)
mail--on the PC05, SVR6 on the Postfi
PC05 on the mail--"SVR6 on the Dovecot (mailbox directory)

Build Dovecot Service:
Install the Dovecot package, default support Pop3,imap these two kinds of receiving agreement,
Can be set to boot as needed
[Email protected] ~]# yum-y install Dovecot
[Email protected] ~]# vim/etc/dovecot/conf.d/10-auth.conf
Disable_plaintext_auth = No (allow clear text communication)
[Email protected] ~]# vim/etc/dovecot/conf.d/10-mail.conf
Mail_location = Maildir:~/maildir (user mail storage directory)

How SMTP Authentication works:
Simple Authentication and Security Layer
Cyrus-sas-plain software package (default installation)
[Email protected] ~]# Rpm-qa | grep Cyrus

Implementation of SMTP authentication:
Start the SASLAUTHD service
[Email protected] ~]# service SASLAUTHD restart
[Email protected] ~]# chkconfig SASLAUTHD on

Adjust postfix configuration, add authentication control parameters
[Email protected] ~]# VIM/ETC/POSTFIX/MAIN.CF
Smtpd_sasl_auth_enable = yes (Enable SASL authentication)
Mynetworks = (Set trust network)
Smtpd_sasl_security_options = noanonymous (prevents anonymous sending)
Smtpd_recipient_restrictions = (set recipient filtering)
Reject_unauth_destination (refusal to send letters to unauthorized targets)

To configure the mail client:
Command line
Create a configuration file for the Mail command on the client computer,
/etc/mail.rc or ~/.MAILRC
[Email protected] ~]# vim ~./MAILRC
Set Smtp=smtp://mail. (sending server)
Set [email protected] (sender address)
Set [email protected] (Specify Authenticated Users)
Set smtp-auth-password= "Taren1" (Specify Authentication password)
Set folder=imap:// (address of the receiving server)
Set [email protected]= "TAREN1" (Receive password)

Mail graphical interface Thunderbird (Thunderbird)


Linux mail server

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: 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.