Skip to main content

Sendmail Installation & configuration on centos with virtual user and domains

The Sendmail program is a very widely used Mail Transport Agent (MTA). MTAs send mail from one machine to another. Sendmail is not a client program, which you use to read your email. Sendmail is a behind-the-scenes program which actually moves your email over networks or the Internet to where you want it to go.. 
This guide show you have to install and configure sendmail with virtual user and domains - 
Installation  -

Check if sendmail is installed or not:
   # rpm –qa | grep sendmail 

If it is not installed, then install the sendmail package using following command:
   # yum install sendmail sendmail-cf

By default sendmail listen on local interface i.e 127.0.0.1
To configure the sendmail to listen to all interface at the host, just comment the following line in “sendmail.mc”:

# vi /etc/mail/sendmail.mc

     From:
     DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

     To
     dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Accepting mail for virtual domains/users
1.Create a new system user and set the password for that user.




useradd exampleuser
passwd exampleuser
2. Add the user to the sendmail’s virtusertable file. Open the ‘/etc/mail/virtusertable’ file and add the following:
Each line in the /etc/mail/virtusertable file should be of the following format:


username@domainname systemuser
3. Add each new domain name to the /etc/mail/local-host-names file


exampledomain.tld
4. Generate a new sendmail.cf file by using the following commands:




cd /etc/mail
make all
/etc/init.d/sendmail restart
Rewriting outgoing email addresses
1. Add the following lines to the /etc/mail/sendmail.mc file:

1
2
3
FEATURE(masquerade_envelope)
FEATURE(genericstable, `hash -o /etc/mail/genericstable')
GENERICS_DOMAIN_FILE(`/etc/mail/sendmail.gdf')

2. Create /etc/mail/genericstable file containing local users mapped to desired addresses:



exampleuser exampleuser@exampledomain.tld
exampleuser2 exampleuser2@exampledomain.tld


3. Create /etc/mail/sendmail.gdf file containing the fully qualified name of the local mail server.


host.exampledomain.tld

4. Finally, generate a new sendmail.cf file:




cd /etc/mail
make all
/etc/init.d/sendmail restart

DONE ...

:)









Comments

Popular posts from this blog

How to balance outgoing emails via multiple IP addresses with postfix

Postfix how to balance outgoing emails via multiple IP addresses The solution is depending on postfix`s TCP_TABLES and a perl script. In my example I`m using 7 different IP address to route outgoing mails, make sure you`ve already the IP addresses you are going to use have been configured on your box. First get a recent postfix rpm from here http://ftp.wl0.org/official/2.9/RPMS-rhel5-x86_64/. This one is built for rhel5/centos5 however should be working without much hassle on rhel6/centos5. Install the package: # rpm -Uvh postfix-2.9.1-1.rhel5.x86_64.rpm Make sure its built with tcp tables support: # postconf -m btree cidr environ fail hash internal ldap memcache nis proxy regexp static tcp texthash unix Install the perl module  List::util::WeightedRoundRobin: cpan install /List::util::WeightedRoundRobin/ Create the following perl script and make it executable: vi /etc/postfix/postfix.pl #!/usr/bin/perl -w # author: ...

How To Block Removable drive in linux

For Block Removable disk like pen drive you have to run only one following command - Open terminal -      #sudo chmod 700 /media For unblock -     # sudo chmod 755 /media   

how to take mails backup in outlook 2007

How to take backup of mails in outlook 2007. there is a very simple way to taking backup of mails 1.Opne outlook 2007 > tools >account > data files >open folder then close all other windows and copy outlook.pst file in a safe location To restore backup 1.Opne outlook 2007 > tools >account > data files > add > and give the location of outlook.pst file.