Sendmail is a MTA (Mail Transfer Agent) server used for transferring email from between different hosts. Sendmail uses SMTP (Simple Mail Transfer Protocol) protocol. Most of system administrators preferred to use Sendmail server as MTA than other MTAs.
RHEL 5 or its earlier versions were using Sendmail as default mail server, But newer version’s of RHEL based systems adapted postfix as default mail server. Most of users are familiar with Sendmail and want to use it with version 6 also. This article will help that users for installing Sendmail server on RHEL 7/6/5 or with minimal configuration.
팩키지를 설치하기 위한 준비
If you don’t have installed Sendmail using following command to install Sendmail with other required packages using yum package manager.
# yum install sendmail sendmail-cf m4
Before starting configuration we must know about various Sendmail configuration files exists in /etc/mail directory.
- access — Allow/Deny other systems to use Sendmail for outbound emails.
- domaintable — Used for domain name mapping for Sendmail.
- local-host-names — Used to define aliases for the host.
- mailertable — Defined the instructions that override routing for particular domains.
- virtusertable — Specifies a domain-specific form of aliasing, allowing multiple virtual domains to be hosted on one machine.
2.1 Comment out below line in /etc/mail/sendmail.mc to allow receiving email from anywhere. To comment a line in sendmail.mc, just put dnl at start of line.
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
2.2 Add this line also in sendmail.mc above ‘MAILER’ option
2.3 Add your PC’s full hostname in this file.
# hostname >> /etc/mail/relay-domains
Recompile Sendmail Configuration
m4 ia a macro processor to compile the Sendmail configuration files. m4 is stream-based, that is, it doesn’t understand about lines.
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Restart Sendmail service
# /etc/init.d/sendmail restart
Configure Domain based E-mail Routing
As we read above that virtusertable file used for aliasing, allowing multiple virtual domains to be hosted on one machine.
1. All emails addressed to @example.com domain delivered to firstname.lastname@example.org
2. All emails addressed to email@example.com will forward to local user jack.
3. All emails addressed to @mydomain.com will forward to domain @otherdomain.com with corresponding usernames.
4. All emails addressed to @otherdomain.com will be rejected my mail server with acknowledging sender with message
@otherdomain.com error:nouser User unknown
After making all changes in virtusertable execute following command to create updated virtusertable.db file containing the new configuration.
# makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable
Now restart Sendmail service
# /etc/init.d/sendmail restart
Thanks for reading this article. I hope this article will help you to configure Sendmail on CentOS and Red Hat systems..
This post is from http://tecadmin.net/install-sendmail-server-on-centos-rhel-server/
개발을 하다보니 제가 코딩한것도 이해가 잘 안가고 ㅋㅋ 그래서 요약하려고 이 사이트를 만들었습니다.