Sendmail is the default mail server installed in linux. It acts as both an MTA (Mail Transport Agent) as well as an MDA (Mail Delivery Agent).
What happens when you send an email ?
- Your email client - which is the Mail User Agent (MUA) passes message to its conmfigured MTA, usually a central mail gateway.
- The MTA routes message to the destination, forwarding to other intermediate MTAs as is necessary.
- Domain or destination MTA passes the message to the Mail Delivery Agent (MDA).
- Finally user recieves the message.
- sendmail
- sendmail-cf and
- sendmail-doc
- /etc/mail/sendmail.cf - This is the main configuration file for sendmail. It contains amoung other things, domain alias directives, header rewriting directives, relaying rules and so on. Usually you do not edit this file directly; but modify the /etc/mail/sendmail.mc file and then incorporate the changes into sendmail.cf by using the m4 command.
- /etc/mail/submit.cf - This file is used when sendmail is called by a user program. Normally it does not need modification.
- /etc/aliases - This file defines a list of local user aliases. For example, you can make root's mail be redirected to another user and so on. This file has to be hashed to the aliases.db format by running the newaliases command each time it is changed.
- /etc/mail/ - This directory contains access control, virtual user database and the above mentioned configuration source files. Note: If you change the contents of the files in this directory, you have to rehash the database by running the make command in the directory. Some of the important files in this directory are as follows:
- local-host-aliases - This file lists all the aliases and domains which the mail server will accept in an incomming e-mail address for local delivery.
- virtusertable - This file maps an email address to a local user. For example, you can send an incomming email to the target specified or forward it to another address.
- access - The contents of this file acts as a filter which decides whether any mail from some user, domain or IP subnet has to be accepted, relayed or rejected. The file contents are divided into two columns. the first column lists the email address/IP address/domain ; and the second column specifies the action that is to be taken.The second column of this file can be one of a few different values:
- REJECT - Rejects the sender with a general purpose message.
- OK - Accepts mail (for recipt, not relay)
- RELAY - Accepts mail for relaying to another server.
- DISCARD - Discard the message completely
- ERROR:550 your message - Like REJECT but returns with your specific message.
You do not modify the sendmail.cf file directly. But you make changes to the sendmail.mc file in the /etc/mail/ directory and then run the command :
# m4 sendmail.mc > sendmail.cf
Then restart the sendmail daemon.# service sendmail restart
Debugging SendmailCheck if sendmail is identifying your station's hostname correctly:
# sendmail -d0 < /dev/null
Version 8.12.11Compiled with: DNSMAP HESIOD HES_GETMAILHOST LDAPMAP LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6 NETUNIX NEWDB NIS PIPELINING SASLv2 SCANF STARTTLS TCPWRAPPERS USERDB USE_LDAP_INIT
============ SYSTEM IDENTITY (after readcf) =======
(short domain name) $w = localhost
(canonical domain name) $j = localhost.localdomain
(subdomain name) $m = localdomain
(node name) $k = localhost.localdomain
===================================================
Recipient names must be specified
/etc/mail/local-host-names must contain server's name and aliases
View SMTP exchange with local relay
# mail -v user
View messages queued for future delivery# mailq
By default the above command displays the queue of messages waiting to be processed by your local MTA for delivery or relay to a remote MTA. Messages can sit in this queue for a long time if the remote host is refusing.
# mailq -Ac
This command displays the queue of messages waiting to be sent by your MSP to the local MTA relay. Messages can sit in this queue for a long time if your local host is having problems with name resolution.
View log in realtime# tail -f /var/log/maillog
During any server configuration or testing, monitoring the appropriate logs with 'tail -f' can be invaluable.
No comments:
Post a Comment