shell script to setup email server on centos

Posted on 2010-04-02
Medium Priority
Last Modified: 2013-12-26
I want  a bash script which will automatically setup a given domain on fresh centos installation so server can receive emails for that domain.

is there any such script? or please guide me how I can do it.
Question by:nasirbest
LVL 14

Expert Comment

ID: 29882826
What mail-server are you running?

If you are running postfix all you need to do is add a domain-name to a line in the config file and do a 'postfix reload'.

But you might wanna run vusers for your mailserver?

LVL 26

Accepted Solution

jar3817 earned 2000 total points
ID: 29903082
A fresh centos install is probably running sendmail. All you have to do is add the domain to /etc/mail/local-host-names and restart sendmail:

# echo "domainname.com" >> /etc/mail/local-host-names && /etc/rc.d/init.d/sendmail restart

If you have iptables running, you might need to add a rule to allow incoming tcp/25. Add this line to /etc/sysconfig/iptables above the last reject/drop rule:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT

Then restart iptables too: # /etc/rc.d/init.d/iptables restart

Author Closing Comment

ID: 31710393

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article outlines some of the reasons why an email message gets flagged as spam on a recipient's end.
The main intent of this article is to make you aware of ‘Exchange fail to mount’ error, its effects, causes, and solution.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question