- on the mail host server machine, edit the file /etc/hosts. Add a CNAME record to your DNS that contains the name of your sendmail server. One example is “172.16.0.1 www.sunny-solutions.com sunny-solutions”.
- modify /etc/sysconfig/network, edit your HOSTNAME. One example is “HOSTNAME=www.sunny-solutions.com”.
- if you have aliases for your mail server name, modify /etc/mail/local-host-names. One eample is “www.sunny-solutions.com”. Make sure that “yourdomain.com” is there otherwise you will get an error as “553 5.3.5 65.49.122.83. config error: mail loops back to me (MX problem?)
554 5.3.5 Local configuration error” - run “echo ‘$=w’ | sendmail -bt -d0.4”, make sure that there is no error messages.
- in the /etc/sysconfig/ipchains file, make sure that smtp
port 25 is open. - in /etc/mail/sendmail.mc file, change default line, “DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)” to “DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA’)”. (Or change origal line to “dn1 DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)”.
- run “m4 /etc/mail/sendmail.mc > /etc/sendmail.cf”. /etc/sendmail.cf is the mail config file. After running this command,
the change in sendmail.mc will be updated in sendmail.cf as well. - restart sendmail daemon by “/etc/rc.d/init.d/sendmail restart”. After running this command, not only localhost(127.0.0.1), but also all the other allow hosts can telnet to port 25 of the host where mail server is running. In other words, it will allow sendmail to accept network connections from any host other than the local computer.
- adding a line “sendmail:ALL” in /etc/hosts.allow to allow that all the mail client can telnet to mail host port 25.
- Mail server should run fine now.
- To allow relay messages for all machines inside your host, follow these steps.
- edit /etc/mail/access file,
172.16. RELAY
# North Korea
co.kr REJECT ” co.kr domains disallowed ”
# Russia
mail.ru REJECT ” mail.ru disallowed ”
# Taiwan
com.tw REJECT ” com.tw domains disallowed ”
net.tw REJECT ” net.tw domains disallowed ”
…. - in the directory “/etc/mail”, run “makemap hash /etc/mail/access.db
- restart the xinetd daemon by “/etc/init.d/xinetd restart”
- to test whether the smtp port 25 is configured correctly, run “netstat -nl” command. It will show that tcp port 25 is listening. And run “lsof -i” command checking whether sendmail is doing the smtp listen.
- to check for mail log file, go to /etc/syslog.conf file.
It should have a line like “mail.* /var/log/maillog”. - run “nslookup $domain” or “dig $domain” to check for mail mx setup.
- run “telnet relay-test.mail-abuse.org” to check for the site is open relay site or not
- PS: http://groups.google.com/groups?q=/etc/hosts.allow+smtp&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3E526023.1020406%40mis.com&rnum=6 is a very nice message to describe almost the same steps here.
- PS: To authroize other machines to send mail through this sendmail server, need to modify /etc/mail/access first by adding the the authorized users. Then “cd /etc/mail”, and run “makemap hash access.db
Setup IMAP and POP3 servers
- By default, Fedora core 3 comes with Cyrus IMAP. The difference between Cyrus IMAP vs. Washington IMAP is: “Cyrus has its own mailbox database which is standalone and increases performance, whereas Washington uses the stanard UNIX mailbox format, which was designed for a smaller set of users. Washington is portable to more UNIX and non-UNIX systems than Cyrus. The main difference is that with Cyrus, you don’t have to add new users to your linux box (i.e. in /etc/passwd) to add new mail users, and with Washington, you do.”
- URL to Cyrus IMAP HOWTO
- On Fedora disk 3, run rpm -Uvh cyrus-imapd-2.2.6-2.FC3.6.i386.rpm, cyrus-sasl-devel-2.1.19-3.i386.rpm, and cyrus-imapd-utils-2.2.6-2.FC3.6.i386.rpm. After installation, by default, “sasl_pwcheck_method: saslauthd” in /etc/imapd.conf.
- Create a default user cyrus. As root, run “/etc/rc.d/init.d/cyrus-imapd start” and “/etc/rc.d/init.d/saslauthd start”. As cyrus, run “/usr/lib/cyrus-imapd/cyradm localhost” to create user and set quota …
- For my case, I need to use the stanard UNIX mailbox format. Go to UW IMAP Information Center to download imap.tar.Z. After unzip the tar file, go under the directory imap-2004a and run “make lrh SSLTYPE=unix”. With SSLTYPE=unix, it will build with SSL but allow plaintext passwords in insecure sessions. Without SSLTYPE=unix, by default, plaintext passwords is not allowed and you will get LOGINDISABLED error.
- After build finishes successfully, copy imapd/imapd, ipopd/ipop3d and ipopd/ipop2d to /usr/sbin.
- Under /etc/xinetd.d, create imap, ipop3, and ipop2. One example of imap file is:
# default: off
# description: The IMAP service allows remote users to access their mail using \
# an IMAP client such as Mutt, Pine, fetchmail, or Netscape \
# Communicator.
service imap
{
socket_type = stream
wait = no
user = root
server = /usr/sbin/imapd
log_on_success += HOST DURATION
log_on_failure += HOST
disable = no
}
- Run “/etc/rc.d/init.d/xinetd restart” to start imap and pop3 server
- Test imapd process by telnet
>telnet yyyy 143
a0001 login
a0002 select inbox
a0003 fetch 1 full
a0004 logout
- By default, Fedora core 3 comes with Cyrus IMAP. The difference between Cyrus IMAP vs. Washington IMAP is: “Cyrus has its own mailbox database which is standalone and increases performance, whereas Washington uses the stanard UNIX mailbox format, which was designed for a smaller set of users. Washington is portable to more UNIX and non-UNIX systems than Cyrus. The main difference is that with Cyrus, you don’t have to add new users to your linux box (i.e. in /etc/passwd) to add new mail users, and with Washington, you do.”
April 9, 2004
Setup Mail Server
Comments Off on Setup Mail Server
No Comments
No comments yet.
RSS feed for comments on this post.
Sorry, the comment form is closed at this time.