M@IL & M@IL SERVERS
Overview Diagram
What is a Mail Server?
With the click of a mouse button, you can send an email from one point of the globe to another in a matter of seconds. Most of us take this process for granted, giving little thought to how it actually works. It's easy to understand how standard snail-mail gets from point A to point B - but how does an email message make its way from a sender to a recipient? The answer to that question revolves around something called a mail server. You can learn more about the role that mail serves play in email delivery by reading on below.
In another words mail server is the computerized equivalent of your friendly neighborhood mailman. Every email that is sent passes through a series of mail servers along its way to its intended recipient. Although it may seem like a message is sent instantly - zipping from one PC to another in the blink of an eye - the reality is that a complex series of transfers takes place. Without this series of mail servers, you would only be able to send emails to people whose email address domains matched your own - i.e., you could only send messages from one example.com account to another example.com account.
Types of Mail Servers
Mail servers can be broken down into two main categories: outgoing mail servers and incoming mail servers. Outgoing mail servers are known as SMTP, or Simple Mail Transfer Protocol, servers. Incoming mail servers come in two main varieties. POP3, or Post Office Protocol, version 3, servers are best known for storing sent and received messages on PCs' local hard drives. IMAP, or Internet Message Access Protocol, servers always store copies of messages on servers. Most POP3 servers can store messages on servers, too, which is a lot more convenient.
The Process of Sending an EmailNow that you know the basics about incoming and outgoing mail servers, it will be easier to understand the role that they play in the emailing process. The basic steps of this process are outlined below for your convenience.
Step #1: After composing a message and hitting send, your email client - whether it's Outlook Express or Gmail - connects to your domain's SMTP server. This server can be named many things; a standard example would be smtp.example.com.
Step #2: Your email client communicates with the SMTP server, giving it your email address, the recipient's email address, the message body and any attachments.
Step #3: The SMTP server processes the recipient's email address - especially its domain. If the domain name is the same as the sender's, the message is routed directly over to the domain's POP3 or IMAP server - no routing between servers is needed. If the domain is different, though, the SMTP server will have to communicate with the other domain's server.
Step #4: In order to find the recipient's server, the sender's SMTP server has to communicate with the DNS, or Domain Name Server. The DNS takes the recipient's email domain name and translates it into an IP address. The sender's SMTP server cannot route an email properly with a domain name alone; an IP address is a unique number that is assigned to every computer that is connected to the Internet. By knowing this information, an outgoing mail server can perform its work more efficiently.
Step #5: Now that the SMTP server has the recipient's IP address, it can connect to its SMTP server. This isn't usually done directly, though; instead, the message is routed along a series of unrelated SMTP servers until it arrives at its destination.
Step #6: The recipient's SMTP server scans the incoming message. If it recognizes the domain and the user name, it forwards the message along to the domain's POP3 or IMAP server. From there, it is placed in a sendmail queue until the recipient's email client allows it to be downloaded. At that point, the message can be read by the recipient.
How Email Clients are Handled
Many people use web-based email clients, like Yahoo Mail and Gmail. Those who require a lot more space - especially businesses - often have to invest in their own servers. That means that they also have to have a way of receiving and transmitting emails, which means that they need to set up their own mail servers. To that end, programs like Postfix and Microsoft Exchange are two of the most popular options. Such programs facilitate the preceding process behind the scenes. Those who send and receive messages across those mail servers, of course, generally only see the "send" and "receive" parts of the process.
At the end of the day, a mail server is a computer that helps move files along to their intended destinations. In this case, of course, those files are email messages. As easy as they are to take for granted, it's smart to have a basic grasp of how mail servers work.
With the click of a mouse button, you can send an email from one point of the globe to another in a matter of seconds. Most of us take this process for granted, giving little thought to how it actually works. It's easy to understand how standard snail-mail gets from point A to point B - but how does an email message make its way from a sender to a recipient? The answer to that question revolves around something called a mail server. You can learn more about the role that mail serves play in email delivery by reading on below.
In another words mail server is the computerized equivalent of your friendly neighborhood mailman. Every email that is sent passes through a series of mail servers along its way to its intended recipient. Although it may seem like a message is sent instantly - zipping from one PC to another in the blink of an eye - the reality is that a complex series of transfers takes place. Without this series of mail servers, you would only be able to send emails to people whose email address domains matched your own - i.e., you could only send messages from one example.com account to another example.com account.
Types of Mail Servers
Mail servers can be broken down into two main categories: outgoing mail servers and incoming mail servers. Outgoing mail servers are known as SMTP, or Simple Mail Transfer Protocol, servers. Incoming mail servers come in two main varieties. POP3, or Post Office Protocol, version 3, servers are best known for storing sent and received messages on PCs' local hard drives. IMAP, or Internet Message Access Protocol, servers always store copies of messages on servers. Most POP3 servers can store messages on servers, too, which is a lot more convenient.
The Process of Sending an EmailNow that you know the basics about incoming and outgoing mail servers, it will be easier to understand the role that they play in the emailing process. The basic steps of this process are outlined below for your convenience.
Step #1: After composing a message and hitting send, your email client - whether it's Outlook Express or Gmail - connects to your domain's SMTP server. This server can be named many things; a standard example would be smtp.example.com.
Step #2: Your email client communicates with the SMTP server, giving it your email address, the recipient's email address, the message body and any attachments.
Step #3: The SMTP server processes the recipient's email address - especially its domain. If the domain name is the same as the sender's, the message is routed directly over to the domain's POP3 or IMAP server - no routing between servers is needed. If the domain is different, though, the SMTP server will have to communicate with the other domain's server.
Step #4: In order to find the recipient's server, the sender's SMTP server has to communicate with the DNS, or Domain Name Server. The DNS takes the recipient's email domain name and translates it into an IP address. The sender's SMTP server cannot route an email properly with a domain name alone; an IP address is a unique number that is assigned to every computer that is connected to the Internet. By knowing this information, an outgoing mail server can perform its work more efficiently.
Step #5: Now that the SMTP server has the recipient's IP address, it can connect to its SMTP server. This isn't usually done directly, though; instead, the message is routed along a series of unrelated SMTP servers until it arrives at its destination.
Step #6: The recipient's SMTP server scans the incoming message. If it recognizes the domain and the user name, it forwards the message along to the domain's POP3 or IMAP server. From there, it is placed in a sendmail queue until the recipient's email client allows it to be downloaded. At that point, the message can be read by the recipient.
How Email Clients are Handled
Many people use web-based email clients, like Yahoo Mail and Gmail. Those who require a lot more space - especially businesses - often have to invest in their own servers. That means that they also have to have a way of receiving and transmitting emails, which means that they need to set up their own mail servers. To that end, programs like Postfix and Microsoft Exchange are two of the most popular options. Such programs facilitate the preceding process behind the scenes. Those who send and receive messages across those mail servers, of course, generally only see the "send" and "receive" parts of the process.
At the end of the day, a mail server is a computer that helps move files along to their intended destinations. In this case, of course, those files are email messages. As easy as they are to take for granted, it's smart to have a basic grasp of how mail servers work.
How To Install Postfix With Dovecot and SASL and Cyrus
Download Source File From using wget
#wget ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-2.9.4.tar.gz
Unzip The Tar
#tar zxvf postfix-2.6.5.tar.gz
Use
#yum install db*-devel if support file needed
Adding group and user for Postfix
#groupadd postfix -g 2000
#groupadd postdrop -g 2001
#useradd postfix -u 2000 -g 2000
#cd postfix-2.6.5
# make -f Makefile.init makefiles 'CCARGS=-DUSE_TLS -DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DDEF_SERVER_SASL_\"dovecot\"' 'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm -lssl -lcrypto'
#make
#make install
Dovecot
Download Stable version of dovecot
#wget http://www.dovecot.org/releases/2.0/dovecot-2.0.21.tar.gz
#tar zxvf dovecot-2.0.21.tar.gz
#cd dovecot-2.0.21
#./configure --with-mysql --with-sql-drivers
#make
#make install
Edit Your Main cf un comment and insert these lines at the bottom
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/local/man
sample_directory = /etc/postfix
readme_directory = no
inet_protocols = ipv4
alternate_config_directories = /etc/postfix2 //Ony in the case of multiple instances
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_client_restrictions = permit_mynetworks,permit_sasl_authenticated,reject
Make these changes to dovecot.conf by uncommenting or adding
By default there will be no conf file in /usr/local/etc/ (to where u installed)
Copy sample file dovecot-example.conf and modify it to
protocols = imap imaps pop4 pop3s
protocol imap {
}
protocol pop3 {
}
protocol lda {
}
ssl = yes
ssl_cert_file=/etc/pki/tls/certs/dovecot.pem
ssl_key_file=/etc/pki/dovecot/private/dovecot.pem
auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}
dict {
}
plugin {
}
Start your postfix by command
#postfix -c /etc/postfix start
#postfix -c /etc/postfix stop;postfix -c /etc/postfix start \\ To restart
Start your dovecot by entering
#dovecot
If any error displays check corresponding log . After that
Check whether it works or not by
:> telnet 127.0.0.1 25
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 localhost.localdomain ESMTP Postfix
ehlo localhost
The response will be some thing like this
250-localhost.localdomain
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
See the 6th line, it must show the authentication mechanisms. Thats it. Now test the authentication as follows.
Check wether it load with postfix by executing these commands
# postconf -A
cyrus
# postconf -a
cyrus
dovecot
#wget ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-2.9.4.tar.gz
Unzip The Tar
#tar zxvf postfix-2.6.5.tar.gz
Use
#yum install db*-devel if support file needed
Adding group and user for Postfix
#groupadd postfix -g 2000
#groupadd postdrop -g 2001
#useradd postfix -u 2000 -g 2000
#cd postfix-2.6.5
# make -f Makefile.init makefiles 'CCARGS=-DUSE_TLS -DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DDEF_SERVER_SASL_\"dovecot\"' 'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm -lssl -lcrypto'
#make
#make install
Dovecot
Download Stable version of dovecot
#wget http://www.dovecot.org/releases/2.0/dovecot-2.0.21.tar.gz
#tar zxvf dovecot-2.0.21.tar.gz
#cd dovecot-2.0.21
#./configure --with-mysql --with-sql-drivers
#make
#make install
Edit Your Main cf un comment and insert these lines at the bottom
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/local/man
sample_directory = /etc/postfix
readme_directory = no
inet_protocols = ipv4
alternate_config_directories = /etc/postfix2 //Ony in the case of multiple instances
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_client_restrictions = permit_mynetworks,permit_sasl_authenticated,reject
Make these changes to dovecot.conf by uncommenting or adding
By default there will be no conf file in /usr/local/etc/ (to where u installed)
Copy sample file dovecot-example.conf and modify it to
protocols = imap imaps pop4 pop3s
protocol imap {
}
protocol pop3 {
}
protocol lda {
}
ssl = yes
ssl_cert_file=/etc/pki/tls/certs/dovecot.pem
ssl_key_file=/etc/pki/dovecot/private/dovecot.pem
auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}
dict {
}
plugin {
}
Start your postfix by command
#postfix -c /etc/postfix start
#postfix -c /etc/postfix stop;postfix -c /etc/postfix start \\ To restart
Start your dovecot by entering
#dovecot
If any error displays check corresponding log . After that
Check whether it works or not by
:> telnet 127.0.0.1 25
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 localhost.localdomain ESMTP Postfix
ehlo localhost
The response will be some thing like this
250-localhost.localdomain
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
See the 6th line, it must show the authentication mechanisms. Thats it. Now test the authentication as follows.
Check wether it load with postfix by executing these commands
# postconf -A
cyrus
# postconf -a
cyrus
dovecot