0% found this document useful (0 votes)
42 views14 pages

Mail Server

Uploaded by

ak19.alamgir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views14 pages

Mail Server

Uploaded by

ak19.alamgir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Linux Mail Server

MTA (Mail Transfer Agent): -


A Mail Transfer Agent (MTA) is an email server software that receives and relays emails. An MTA
receives messages from another MTA or from a Mail User Agent (MUA), which is a computer application
that end users use to access or send emails. Once an MUA relays an email to an MTA, the MTA takes
over and sends it to the receiving MTA via Simple Mail Transfer Protocol (SMTP).

Message transfer agents typically work through back end server applications, and users do not interact
directly with this software. Instead, users will interact with a mail user agent. However, this process is
fairly straightforward. A mail transfer agent receives mail from another MTA or a similar software such
as a mail submission agent or mail user agent. In this transfer, the SMTP will specify the transmission
details. When an MTA receives an email message, the software will add a “received” trace header to the
message’s header. During this process, the message will build a sequential record of the MTAs that have
handled the message.

Ex. Send mail, Postfix, Exim, Qmail, Alpine.


MUA (Mail User Agent): -

The MUA is normally a program which is used to send and receive mail. Sometimes, it is called as mail
reader. It accepts variety of commands for composing, receiving and replying to messages as well as for
manipulation of the mailboxes.

MSA (Mail Submission Agent): -

A message submission agent (MSA), or mail submission agent, is a computer program or


software agent that receives electronic mail messages from a mail user agent (MUA) and
cooperates with a mail transfer agent (MTA) for delivery of the mail. It uses ESMTP, a variant
of the Simple Mail Transfer Protocol (SMTP), as specified in RFC 6409.[1]

Many MTAs perform the function of an MSA as well, but there are also programs that are
specially designed as MSAs without full MTA functionality.[citation needed] Historically, in Internet
mail, both MTA and MSA functions use port number 25, but the official port for MSAs is 587.[1]
The MTA accepts a user's incoming mail, while the MSA accepts a user's outgoing mail.

MDA/LDA (Mail Delivery Agent or Local Delivery Agent): -

Mail delivery agent, is a computer software component that is responsible for the delivery of e-
mail messages to a local recipient's mailbox.[1] It is also called a local delivery agent (LDA).

Within the Internet mail architecture, local message delivery is achieved through a process of
handling messages from the message transfer agent, and storing mail into the recipient's
environment (typically a mailbox).

Ex. Dovecot, Getmail, Fetch mail, Mail drop ,Procmail


MRA (Mail Retrieval Agent): -
A mail retrieval agent (MRA) is a computer application that retrieves or fetches e-mail from a remote
mail server and works with a mail delivery agent to deliver mail to a local or remote email mailbox.
MRAs may be external applications by themselves or be built into bigger applications like a mail user
agent. Significant examples of standalone MRAs include fetchmail and getmail.

SMTP (Simple Mail Transfer Agent): -


SMTP (Simple Mail Transfer Protocol) is a TCP/IP protocol used in sending and receiving email.

 An email server uses SMTP to send a message from an email client to another email server.
 The email server uses SMTP as a relay service to send the email to the receiving email server.
 The receiving email server uses an email client to download incoming mail via IMAP, for
example, and places it in the recipient's inbox
These servers typically use TCP on port 25 or 587
Fetchmail /Getmail :-
Fetchmail is an open-source software utility for POSIX-compliant operating systems which is used to
retrieve e-mail from a remote POP3, IMAP, or ODMR mail server to the user's local system.

Fetchmail is a mail-retrieval and forwarding utility; it fetches mail from remote mail servers and
forwards it to your local (client) machine's delivery system. You can then handle the retrieved
mail using normal mail user agents (MUA) such as mutt(1), elm(1) or Mail(1). The fetchmail
utility can be run in a daemon mode to repeatedly poll one or more systems at a specified
interval.

The fetchmail program can gather mail from servers supporting any of the common mail-
retrieval protocols: POP2 (legacy, to be removed from future release), POP3, IMAP2bis,
IMAP4, and IMAP4rev1. It can also use the ESMTP ETRN extension and ODMR. (The RFCs
describing all these protocols are listed at the end of this manual page.)

While fetchmail is primarily intended to be used over on-demand TCP/IP links (such as SLIP or
PPP connections), it may also be useful as a message transfer agent for sites which refuse for
security reasons to permit (sender-initiated) SMTP transactions with sendmail.

Procmail :-
Procmail is a program for filtering, sorting and storing email. It can be used both on mail clients
and mail servers. It can be used to filter out spam, checking for viruses, to send automatic
replies, etc. procmail is a LDA or local delivery agent. The most common use case for procmail
is filter mail into different mailboxes, based on criteria such as sender address, subject keywords,
and/or mailing list address.

Another use is to let procmail call an external spam filter program, such as SpamAssassin. This
method can allow for spam to be filtered or deleted.

After receiving mail, it can sort and deliver mail to different directories and it has built-in spam
filtering capability. here you can see on the left diagram procmill is being invoked by another
program which downloads mail from various sources and delivered to procmail and procmail
reads its instruction and deliver mail to user’s mailboxes. on the right side when email comes to
mail server during local delivery local built-in delivery agent can invoke procmail for delivering
with its filtering rules.

Domain @catchall address: -

Domain catchall address this is a special type address. we define this on the mail server to
receive all email of a domain to the single account later we download and distribute each user's
email from this account. this is very helpful for those email server which are not always online.
during the main server offline mail comes to the catch-all address and saves permanently on the
ISP data center then when the server gets online it downloads all the email from the catch-all
address and delivered to the user's mailbox.
Dovecot POP/IMAP Server: -

Dovecot is an open-source IMAP and POP3 server for Unix-like operating systems, written primarily with
security in mind. The primary purpose of Dovecot is to act as mail storage server. Mail is delivered to the
server using some mail delivery agent (MDA) and stored for later access with an email client (mail user
agent, or MUA). Dovecot can also act as mail proxy server, forwarding connection to another mail
server, or act as a lightweight MUA in order to retrieve and manipulate mail on remote server for e.g.
mail migration.

Dovecot can work with standard mbox, Maildir, and its own native high-performance dbox formats. It is
fully compatible with UW IMAP and Courier IMAP servers’ implementation of them, as well as mail
clients accessing the mailboxes directly.

Mbox/Maildir:-
Email Relay: -

email relay means allowing someone or some network users to send their email to the mail
server. server needs to allow the users this is called allowing for relay email. normally relay
access permission is denied explicitly for all users we need to allow clients with their IP or
subnet or we can allow them to user name and password this is called authentication based relay.

Transport: -

transport server or mail router transport server receives email from the internet and forward them
to another defined destination. transport servers do not MX lookup to find the destination server
rather it's clearly mentioned on the transport server where to deliver the emails for any specific
domain. transport server delivers emails to the internal mail servers it works like a mail router.
Here you can see that we have three domains here and the central mail router is actually
receiving mail for all these three domains and it forwarding emails to the respective mail servers
for a particular domain.

Email Local Delivery: -

emails local delivery means delivering email to mailboxes. local delivery happens on such server
where the mailbox results. so, the mailbox server does the local delivery through the local
delivery agent. here you can see the LDA or local delivery agent is delivering mail to the user’s
mailbox and users retrieves the Mail's from this server by pop IMAP server.

Remote Delivery: -

Delivery means receiving email for recent to the remote mail server where the emails are
destined to. remote delivery happens at regular mail server or a gateway service. mailbox server
doesn't receive mail for remote delivery. remote delivery happens to remote delivery agent like
SMTP.
Inbound relay or Inbound gateway: -

inbound gateway system receives mail for the users and recent inbound. inbound gateway system
basically an MX system which receives at first place for the domain and forward the mail to the
mailbox server inside the network from where user will download their emails.

Smart host or Outbound gateway: -

smart host sends mail on the internet on behalf of the internal servers. a smart host receive mails
from the internal servers who doesn't want to send mail directly instead they deliver their email
to the intermediary server for the final delivery. smart host system receives mail from the internal
systems based on the relay authentication. normally at the ISP end they setup smart host to relay
various organizations server email.
Incoming Scanner

incoming scanner receives emails for the domain and scans for the spam and viruses incoming
scanner is always internet-facing after scanning it delivers cleaned mail to the internal mailbox
server or transport server to read out mail to the organization's mail server incoming scanner can
be on-premise or we can setup it on the cloud or at the ISP level

outgoing scanner

outgoing scanner scans email before delivered to Internet servers it is also internet facing but it is
sent only system it doesn't receive mail from the internet it receives mail from its authenticated
internal servers only to relay mail on behalf of them and before relay it cleaned the Mail's from
spam and virus’s smart hosts can be an outgoing scanner or before we send mail to the smart host
we can clean the mail from the mail originating server
DNS round-robin

DNS round-robin this is a special feature of DNS. we can configure DNS such a way that during
MX lookup DNS will answer the query with a different IP address for each request. on the DNS
there will be only one MX record with a host name but the host record will be created multiple
times with a different IP. when a MX query happens from the remote mail server for the email
delivery DNS resolves the host mentioned on the MX record and to resolve the host record it
picks a different IP on each request DNS maintains this with a round robin fashion so if we have
three mail server with a different IP assigned we can create a DNS round-robin MX record for
incoming load distribution in that case first request will get the first server IP second request will
be answered with the second server third server for the third request and the fourth request will
be answered again from the first server in this way it will round-robin for each requests so the
incoming mail load will be distributed to three different server on a later video I'll show you how
to implement this on DNS.

primary and backup MX

primary MX means the primary mail server who is responsible to receive domain C mail .if the
primary mail server is not alive then backup a mx or backup mail server can receive
mails .backup a mix will not deliver the mail to the mailbox server or to the users instate it will
wait for the primary one to become alive .when the primary became alive backup MX handover
the emails to the primary for delivery to the user .we define primary and backup a mx at the DNS
with the priority setting primary has the lower preference value than the backup MX.

SMTP load balancer


SMTP load balancer is used when the email load gets too high. SMTP load balancer sits at the
front and takes all the load and delivers the emails at the servers behind. SMTP load balance are
normally used at ISP environment where they need to handle millions of emails per hour .one or
two server are not sufficient to handle this volume of email per hour. servers will get too
exhausted and impractical delay of mail delivery could occur. a load balancer comes in handy in
this scenario it reduces the load by distributing the mail on multiple servers. we can deploy
SMTP load balancer for both incoming and outgoing traffic on a later video I will show you how
to setup and configure SMTP load balancer.

SMTP authentication

SMTP auth means an authentication on SMTP. this is a relay mechanism before allowing clients
for relay they must authenticate themselves with a username and password. allowing clients
based on SMTP authentication is more popular and appropriate than allowing clients with their
IP or network. if user stays at remote, we cannot allow them based on IP or network subnet. in
that case there has to use webmail for email sent but if we enable SMTP authentication clients
can connect to server' from anywhere and they will get the permission to send mail through the
server based on the authentication. now these days most of the email provider requires SMTP
authentication for their clients to relay mail through the ISP mail servers
Ubuntu mail server configuration

You might also like