What is Sendmail? Sendmail Configuration and Details
Have you ever heard about Sendmail? If you are running a cPanel website, you should be familiar with the Exim and you may know how Mail Transfer Agent (MTA) works. As cPanel has become the most popular control panel, Exim has become the popular MTA. cPanel has Exim as the default MTA. Even for those who don’t use a control panel will compile Exim as their mail server. There exist other Mail Transfer Agents in the web hosting industry. Sendmail is an MTA just like Exim, and is the most popular Unix-based implementation of the SMTP protocol for the email transmission. Just like other mail servers, Sendmail will try to deliver the incoming emails to the recipient end immediately. As in the case of exim, we need to use a Mail Delivery Agent (MDA) with POP3 of IMAP protocol.
Sendmail is a descendant of the deliver mail program written by Eric Allman. Allman wrote the ARPANET deliver mail which was shipped in 1979. He wrote Sendmail as a derivative of deliver mail in the early 1980s at UC Berkeley. It shipped with BSD 4.1c in 1983, and it was the first BSD version which included TCP/IP protocols.
How to configure the Sendmail?
Let’s have a look on how to configure the Sendmail. Before seeing the configuration setting, first we need to look on the working of configuration file. Please be aware that the configuration file of Sendmail is sendmail.cf. This file is a product of the macro configuration file, sendmail.mc and you have to make configuration changes on the macro file. The changes made directly to the sendmail.cf file may not be reflected in the live environment. However, sometimes it will work. So that, It is not recommended that performing changes on the sendmail.cf file directly. Once you change the macro file, it will be resulting in the change in .cf file. There are prewritten macros in the sendmail.mc file which will create the sendmail.cf file. These will be present in the directory “cf”. The custom macros are kept in a directory “cf/cf”. The macro file will be parsed against the other m4 scripts, resulting in the creation of sendmail.cf file. In short, the creation of sendmail.cf can be explained as follows:
m4 ../m4/cf.4 sendmail.mc > sendmail.cf
This is how to create a Sendmail configuration file, sendmail.cf. The contents of a sample sendmail.cf file is provided below.
VERSIONID(`this is my custom sendmail.mc for linux – 201209302222′)dnl
dnl define(`confSMART_HOST’,`your.upstream.isp.smtp.service.tld’)dnlTURE(`access_db’,`hash -T <TMPF> /etc/mail/access’)dnl
Now, let’s see the explanation of the above contents.
In Red Hat, the sendmail.cf file comes with an include reference. It will show the following:
Typically the configuration file for Sendmail will be starting with the version ID.
VERSIONID(`This is my custom configuration for Sendmail v0.1′)dnl
The next line will provide you the information about the OS. It will be as below.
The various OS type are Linux, hpux11, aix5, etc.
The next line is the domain specific settings. This will be as the following.
This line is used to apply the domain specific configurations particular to your domain. The ‘generic’ is a profile which will allow the standard mail functionality for IPv4.
There are many features that Sendmail supports. We can disable the unwanted features to ensure greater security. To disable the feature, you should use the undefine as shown below.
The next lines indicate how to mask the identity of the server.
This includes masking the implementation and versioning of this release. To mask the versioning of the release, we need to clear the help file. This can be achieved with the following command.
# echo ” ” > /etc/mail/helpfile
The daemon options can be set with the following options.
The options possible here are:
a – always require authentication
b – bind to interface through which mail has been received
c – perform hostname canonifcation (.cf)
f – require fully qualifed hostname (.cf)
s – Run smtps (SMTP over SSL) instead of smtp
u – allow unqualifed addresses (.cf)
A – disable AUTH (overrides ’a’ modifer)
C – don’t perform hostname canonifcation
E – disallow ETRN (see RFC 2476)
O – optional; if opening the socket fails ignore it
S – don’t offer STARTTLS
We can masquerade the domain with the following line.
Next section is the mailer section. This section defines the local transports available and the order in which the transports are used. This can be set with the following line.
You can use the following options for SMTP.
“smtp” to do regular SMTP
“esmtp” to do ESMTP
“smtp8” to do 8bit MIME
“dsmtp” to do on demand delivery
“relay” for transmission to the RELAY_HOST, LUSER_RELAY, or MAIL_HUB.
This is how configuring the Sendmail please look on the sample configuration file in case of any doubts.
If you need any further assistance please contact our support department.