Electronic Mail Servers

Electronic mail, most commonly referred to as email or e-mail since 1993, is a method of exchanging digital messages from an author to one or more recipients. Modern email operates across the Internet or other computer networks. Some early email systems required that the author and the recipient both be online at the same time, in common with instant messaging. Today's email systems are based on a store-and-forward model. Email servers accept, forward, deliver, and store messages. Neither the users nor their computers are required to be online simultaneously; they need connect only briefly, typically to an email server, for as long as it takes to send or receive messages.

Mail Systems.
In theory, a mail system consists of four distinct components;
Mail User Agent
Email users employ a user agent to read and compose message. Email messages originally consisted only of text, but a standard known as Multipurpose Internet Mail Extensions (MIME) is now used to encoded text formats and attachments into email.

Mail Transport Agent.

A transport agent must accept mail from a user agent, understand the recipients addresses, and somehow get the mail to correct hosts for delivery. Most transport agents also act as message submission agents  for the initial injection of new messages into the mail system. Transport agent speaks Simple Mail transfer Protocol (SMTP) or Extended SMTP. Several transport agents are available for UNIX and Linux systems, PMDF, Postfix, Sendmail, Smail, Qmail, Exim and Zmailer among others.

Delivery Agent.

A delivery agent accepts mail from a transport agent and actually delivers it to the appropriate local recipients. Mail can be delivered to a person, to a mailing list, to file, or even to a program.

Message Stores.

The message store is the spot on the local machine where email is stored. It used to be the directory /var/spool/mail or /var/mail, with mail being stored in files named after user's login names, but ISPs with millions of email clients are looking to other technologies for the message store (eg: Database).

Access Agents

Programs such as imapd and spop are access agents for PC, Mac or linux users whose mail is delivered to linux server and then downloaded with the Internet Message Access Protocol (IMAP) or the Post Office Protocol (POP) respectively.


The Anatomy of a Mail Message.
A mail Message has three distinct parts;
  • The envelope.
  • The headers.
  • The Body of the message.
The envelope determines where the message will be delivered or if the message can't be delivered to whom it should be returned. The envelope addresses generally agree with the From and TO lines of the header. The header record all kinds of information about the message, such as the date and time it was sent and the transport agents through which it passed on its journey. The body of the message is the actual content to be sent. It must consist of plain text.

The EXIM Mail System.

EXIM was written in 1995 by Philip Hazel of the University of Cambridge and is distributed under GNU GPL. EXIM4 was released in 2002 and is currently the version distributed with Debian. Some Separate commands in EXIM performs specific mail functions.
exim -bq Shows the mail queue.
exim -bS Batched SMTP connection.
exim -q Runs the mail queue.

EXIM Configuration.
Exim contains three logical pieces; directors, routers and transports. Directors hale the local address (address inside the home domain). Routers handle remote addresses and Transport do the actual delivery.

EXIM4 system is configured through an elaborate collection of configuration files that lives in /etc/exim4/conf.d. After any modification  for one of these files, must run the update-exim4.conf command, which then creates /var/lib/exim4/config.autogenerated. The config.autogenerated file is used by EXIM at run time.

The EXIM configuration files are well documented, with comments preceding each variables to describe what the variable does. Some part of EXIM run set user ID upon execution to root, therefore, it's particularly important to stay updated on security patches. EXIM define administrative users who are allowed to initiate queue runs. The SMTP verify command (VRFY) is allowed by default. EXIM must be sent the sign up signal with the kill command when its config file changes. It typically logs to files in the /var/log/exim4 directory but can also use syslog. EXIM permits forwarding of outgoing mail to a smart host and filtering of inbound mail at both the host and user levels. It supports virtual domains and has a retry database. EXIM includes recognition of alias and forwarding loops and sensible handling of them.

For configuring basic EXIM4 server;

#apt-get install exim4

# nano /etc/exim4/update-exim4.conf.conf  Go to last 13 lines.
dc_eximconfig_configtype='local' Locol means locol host, to make it a send out server put that to 'internet'
dc_other_hostnames='debian' Here have to give all the domain names separate with a colon (:) (if got a webserver or DNS) or for mail server just give mail.growwithlinux.blogspot.com
dc_local_interfaces='127.0.0.1 ; ::1' Here have to give ip addresses for all the sites separate with a colon (:) or just the ip address of mail server.

eg:
dc_eximconfig_configtype='internet'
dc_other_hostnames='www.example.com: games.example.com: mail.example.com'
dc_local_interfaces='128.10.12.2: 128.10.12.3: 128.10.12.4'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

Relaying is a process of a Domain send mail with help of another Domain, eg; if a company name example.com got a mail server and it's sister company named ask.com only have a web-sever, the  ask.com can send the mail user@ask.com via example.com's mail server for that need to activate relay in example.com's mail server.

dc_eximconfig_configtype='internet'
dc_other_hostnames='www.example.com: games.example.com: mail.example.com'
dc_local_interfaces='128.10.12.2: 128.10.12.3: 128.10.12.4'
dc_readhost=''
dc_relay_domains='www.ask.com: games.ask.com: mail.ask.com'
dc_minimaldns='false'
dc_relay_nets='172.20.10.3: 172.20.10.4: 172.20.10.4'
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
 


After setting above file need to save the file and need to define hostname and mailname of that server.
 #nano /etc/hostname Give the correct host name (www.example.com)
#nano /etc/mailname Give the correct mail name (mail.example.com). 

Restart the EXIM by
#/etc/init.d/exim4 restart

If the relay also set in mail server the two domains must communicate for that must give details of each other DNS details. For that login to other domain using;
#sftp {other domain ip address}
    >{password}

#cd /etc/bind On other domains bind location (ask.com)
#lcd /etc/bind On own domain bind location (examples.com)

#put examples.* Put all the examples servers bind file in ask servers bind file
#get ask.*  Get all the ask servers bind file in example servers bind file

Restart the services. 

If there want to be any any changes in conf.d files in exim4, visit the links along with the directory name.
acl
auth
main
retry
rewrite
router
transport

No comments:

Post a Comment