Sendmail Quick Reference

ADVERTISEMENT

Sendmail Quick Reference
Used for host mutiple virtual domains.
virtusertable
You can use define in .MC file to change some default settings:
Author: Jialong He
define(`ALIAS_FILE',
location of aliases file
SAMPLE /etc/aliases
`/etc/aliases')
#
use external outgoing server
define(`SMART_HOST',`smtp.
#
>>>>>>>>>>
The program "newaliases" must be run after
What is Sendmail?
')
#
>> NOTE >>
this file is updated for any changes to
Sendmail is the most popular mail server software and runs on Unix/Linux
define(`confME_TOO', true)
In aliases mailing, if sender is in the
#
>>>>>>>>>>
show through to sendmail.
list, also send copy to the sender.
computers. The freeware version is available from:
#
Maximum size of mail (0: no limit)
define(`confMAX_MESSAGE_
Sendmail relies on a configuration file sendmail.cf which normally resides
# Basic system aliases -- these MUST be present.
SIZE', 0)
in /etc/mail directory. It is not easy to modify this file directly. One should
mailer-daemon: postmaster
modify sendmail macro configuration file: /etc/mail/sendmail.mc and then
postmaster:
root
generate sendmail.cf with m4 macro processor: m4
root:
jialong
Access Control
/etc/mail/sendmail.mc > /etc/mail/sendmail.cf
#============================================
An access database can be created to accept or reject mails from selected
For new configuration file to take effects, you must restart sendmail
# mailing list
domains or senders. You edit a text file /etc/mail/access. Each
daemon. On Redhat, use: service sendmail restart
#============================================
domain/computer/senders can be followed by: OK, RELAY, REJECT, or
list: :include:/home/jialong/list.txt
DISCARD.
Macro Configuration File - sendmail.mc
jialong: ,
jialong@tiger.la.asu.edu
#---------------------------------------
In sendmail.mc, any thing after “dnl” is treated as comments. A block of
# SAMPLE of /etc/mail/access
#---------------------------------------
comments are delimited by divert(-1) and divert(0). To use string value,
use back tick (`) and end quota (')
localhost.localdomain RELAY
localhost
RELAY
You must specify OSTYPE for OS dependent definitions, for example
127.0.0.1
RELAY
SAMPLE /etc/mail/sendmail.mc
REJECT
OSTYPE(`linux'). Optionally, you can specify using DOMAIN dependent
definitions, e.g., DOMAIN(`generic'). Note: must use back tick (`) and
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
After modifying access text file, you have to create database map with
end quota (') to enclose a string value.
VERSIONID(`setup for Red Hat Linux')dnl
command: makemap hash /etc/mail/access.db < /etc/mail/access
OSTYPE(`linux')dnl
At the end of .MC, give mailer for Internet and Local mail
define(`SMART_HOST',')dnl
if FEATURE(use_cw_file) is used, sendmail will read /etc/mail/local-
MAILER(smtp)
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
host-names file to get alternate names for this host. You can list machine
MAILER(procmail)
define(`ALIAS_FILE', `/etc/aliases')dnl
names that treat as localhost for RELAY.
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
Use FEATURE(keyword) to enable desired features. Here are some useful
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
keywords. For complete list of features, see
FEATURE(redirect)dnl
Aliases file and $HOME/.forward
FEATURE(always_add_domain)dnl
A system wide aliases file (/etc/aliases) provides alternate names for
FEATURE(use_cw_file)dnl
After you changing sendmail.mc, you generate new sendmail.cf with:
individual users, forwarding of mail to other hosts and mailing lists. This is
FEATURE(use_ct_file)dnl
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
a text file. You can also include an external file in the aliases file
FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db',`hash -T<TMPF> -o /etc/mail/access.db')dnl
Keyword
Description
aliasname: recipient[, recipient,...]
FEATURE(`blacklist_recipients')dnl
In aliases file, use following entry to tell
redirect
listname: :include: /path/filename
EXPOSED_USER(`root')dnl
sender the new address:
dnl # The following causes sendmail to only listen on the IPv4 loopback
foo: .REDIRECT
After modifying aliases file, you must run newaliases to rebuild aliases
dnl # address 127.0.0.1 Remove the loopback address restriction to accept
By default, names listed in /etc/mail/access
database.
relay_hosts_only
dnl # email from the internet or intranet.
treated as domain. Allow only computer name.
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
An individual user can create a .forward file in his home directory to
dnl FEATURE(`accept_unresolvable_domains')dnl
access_db
Turns on the access control feature.
forward mails send to him. It is possible put many email addresses in the
LOCAL_DOMAIN(`localhost.localdomain')dnl
Turns on the ability to block incoming mail for
.forward file and use it as a mailing list.
blacklist_recipients
dnl MASQUERADE_AS(')dnl
certain recipient usernames, hostnames, or
MAILER(smtp)dnl
addresses.
Keep a copy in mailbox and forward a copy
MAILER(procmail)dnl
\jialong
# using \ to prevent further expand
Read /etc/mail/local-host-names file to get
use_cw_file
alternate names for this host (for multiple host
name).
Read /etc/mail/trusted-users file to get trusted
use_ct_file
users that allow set sender address.

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go