Site hosted by Angelfire.com: Build your free website today!
   
  pSeries Tech Tips
   
  Sendmail Tips
 

Here are some Sendmail troubleshooting tips I have gleaned from various sources:

- To find out if sendmail is running:
ps -ef | grep sendmail


- To stop and restart sendmail:
stopsrc -s sendmail
startsrc -s sendmail -a "-bd -q30m"
----- OR -----
refresh -s sendmail


Use the -v flag on the mail command for "verbose" output.
This is ESPECIALLY useful if the customer can't deliver mail, but claims he isn't getting any errors.


- To get sendmail to work on a system WITHOUT DNS:
Create and/or edit /etc/netsvc.conf
It should contain 1 line only: hosts=local


 - To correct "warning: local hostname is not qualified." OR
"warning: local hostname doesn't have a domain":

Edit /etc/hosts, and find the line pertaining to the
TCP/IP hostname (not localhost). It will probably be
in this format:
[ip] [hostname]
Change it to this:
[ip] [hostname] [hostname].

The '.' forces sendmail to believe that the domain name is complete.
You can also add a .com to your hostname


- To correct "warning: world writeable directory /etc.":
chmod 755 /etc
chown root /etc and chgrp system /etc for good measure.


- To determine the version of sendmail running on the system:
telnet localhost 25

You should see something like this:
Connected to loopback.
Escape character is '^]'.
220 lyons.bpsolutions.net ESMTP Sendmail AIX4.3/8.9.3/8.9.3;
Thu, 9 Dec 1999 15:26:55 -0600

For AIX 4.3.3, make sure that it doesn't say something like
AIX4.3/8.9.3/8.8.8. This happened with a customer on a migration from 4.3.2 to 4.3.3. Both /etc/sendmail.cf and
/etc/aliases were backlevel.

Alternatively, you can try this:
echo \$Z | /usr/sbin/sendmail -bt -d0


If you want to forward mail
to your self or for all mail or send to several users, you have a few options:
.forward file (dot forward)
1) Verify that the file .forward exists in the home directory.
2) you are the owner of it;
3) it's mask is 600.
forward


Or Mail Aliases
Aliases are only necessary if you want the mail automatically routed to another mail system (perhaps Outlook/Exchange/Notes). something like the following:

MAILER-DAEMON:root
postmaster:root
nobody: /dev/null
sys_adm: root
sys_adm2: root
myuser:myuser@mysystem.com
anotheruser:anotheruser@mysystem.com
root:anotheruser,myuser

This way, all root mail is forwarded to both admins. In turn, the mail is forwarded to my notes because I specified a fully qualified Internet E-mail address.
alias


- To get a current default version of /etc/sendmail.cf or /etc/aliases:
Look in /usr/lpp/bos.net/inst_root/etc.


- To verify that a remote system is accepting smtp messages:
telnet [remote host] 25

If you get a "connection refused", then the remote system isn't accepting smtp messages.


SOFTWARE ERROR CODELABEL: SRC
IDENTIFIER: E18E984F

Node Id: localhost
DETECTING MODULE
'srchevn.c'@line:'288'
FAILING MODULE
sendmail

Check the /etc/hosts file and make sure the loopback line is there.
127.0.0.1 loopback localhost # loopback (lo0) name/address

Make sure there are no spaces or weird characters in front of it. Can you ping localhost and by IP as well? If you are using DNS, check the setup of the machine. 

Do a netstat -rn and see if lo0 is up. If not you may need to do a chdev to make the state up.
chdev -l lo0 -a state=up

now can you ping lo0? can you ping loopback?


More CONFIGURATION Info:

If DNS and/or NIS is used, you may need to modify the /etc/sendmail.cf file slightly. There are three lines that must be added, one to define the "w" macro (which specifies your hostname), one to define the "D" macro (which specifies your DNS domain name), and one to define the "w" class (which specifies your hostname aliases). Following are the lines that need to be added to the /etc/sendmail.cf file on the machine named gorf.austin.ibm.com which also goes by the name of server.austin.ibm.com:

Dwgorf
DDaustin.ibm.com
Cw $w $?D$w.$D$. server server.austin.ibm.com

To find where these lines needed to be inserted in this file, just do a search in 'vi' on the first two letters of each line. There are example lines already in this file, but they are commented out. Just insert each of these lines after the ones that are commented. For example, the lines will originally look like:

#DwYourHostname
#DDYourDomain
#Cw $w $?D$w.$D$. YourHostAlias
Modifying these for the example above makes them look like:

#DwYourHostname
Dwgorf
#DDYourDomain
DDaustin.ibm.com
#Cw $w $?D$w.$D$. YourHostAlias
Cw $w $?D$w.$D$. server server.austin.ibm.com

NOTE: Always make a backup of the current /etc/sendmail.cf file before making modifications.


Other things we tried that seemed to work without DNS Dwhostname
Cwlocalhost
(seems to work we also did this:
CW $w $? $m$w.$m$. hostname.com
(and it worked as well)
Original line shows this...:
Cw localhost $w $?m$w.$m$. YourHostAliases
#Cm $m YourOtherDomainNames


- For older versions of AIX (4.1.5 and older), don't forget to enable MX records. There is a line in /etc/sendmail.cf (commented out by default) that reads "OK MX". Uncomment this line.


Other things to try:
nslookup hostname
host IP
host hostname
netstat -in
mailq
sendmail -v -q
mail -v user@hostname.com


FIX $j in config file
Because sendmail is built to use a DNS, sendmail also expects the host
name to have a domain name. If a host running sendmail does not have a
domain name, sendmail will loop because it cannot define the Dm
variable. The typical error message is fix $j in config file, but this
is misleading so don't fix $j in the config file. This is fixed one of
two ways.

Edit the /etc/hosts file and give the local systems host name a domain
name 1.1.1.1 bogus will become 1.1.1.1 bogus.lab.net bogus (the short
name was moved to the alias position) or 1.1.1.1 bogus. This is
considered incorrect but will work as long as the DS variable is not
defined. 


New Change in 4.3.3
There are new anti-spam features. By default anti-spam features are not activated. So it is necessary to generate or modify sendmail.cf file with anti-spam features.

Feature - (relay_hosts_only )
by enabling this feature, sendmail only accepts mail from hosts listed in configuration database for relatying.

Feature- (rbl)
This feature directs sendmail to reject hosts found in the Realtime Blackhole list. By default sendmail trys to look up rbl.maps.vix.com.

Feature- (accept_unqualified_senders)
When this feature is enabled, sendmail accepts mail which sender addresses without domain names (name instead of name@domain). By default sendmail does not accept mail of this type.

Feature - (accept_unresolvable_domain)
When this feature is enabled, sendmail accepts mail that has an unresolvable return address. By default sendmail does not accept mail of this type.

Feature - (promiscuous_relay)
This feature allows relaying from any site to any site. Activating this feature is not encouraged.


Software Dependencies
4.3.3. base operating system with tcpip configured
for NIS and LDAP databases -- NIS and LDAP filesets must be installed
. for IDENT protocol support, IDENT must be installed. Currently IDENT is not provided by AIX and must be obtained off the net. The sendmail daemon queries every outside connecting host with the RFC1413 identification protocol to record the identity of the user at the other end who made the connection and to verify the true name of the remote connecting host.


To generate a customized sendmail.cf file
To generate a customized sendmail.cf, it is necessary to customize /usr/samples/tcpip/sendmail/cf/aix433.mc file. You can change, add or modify the file to suite your site requirements. The customized file should look like:
divert(0)dnl
OSTYPE(aix433)dnl
FEATURE(genericstable)dnl
FEATURE(mailertable)dnl
FEATURE(virtusetable)dnl
FEATURE(domaintable)dnl
#FEATURE(promiscuous_relay)dnl
#FEATURE(accept_unresolvable_domains)dnl
#FEATURE(accept_unqualified_senders)dnl
DOMAIN(generic)dnl
MAILER(local)dnl
MAILER(smtp)dnl
MAILER(uucp)

Then issue the following command to generate the customized sendmail.cf file
#cd /sur/samples/tcpip/sendmail/cf
# m4 ../m4/cf.m4 aix433.mc > sendmail.cf
See /usr/samples/tcpip/sendmail/README for more information about anti-spam features and general configuration methods.


MS exchange Server Steps

Step one: vi /etc/hosts to have a fully qualified name i.e 199.99.99.99 myhost myhost. (add the . or .com to the name of the rs6000 machine)

Step two: add a fully qualified name to the Exchange server as well...and make sure it will respond to a fully qualified name.
i.e 199.99.99.98 mailhost mailhost.

you must first make sure that your exchange server is setup as a smtp gateway listening on port 25 , and that the unix server can see the server . before you configure sendmail
you should be able to telnet to the server on port 25
i.e. telnet exchange server 25 , and send a message successfully. You must make sure the exchange server allows address to be received and forwarded to the relevant parties.

telnet (ip address / host file name of server) 25
 if you don't get a response, check that exchange server is running and listening on port 25 on NT server. Check server can be pinged from UNIX box .
if successful you'll get the following

Trying...
Connected to exchange_server.
Escape character is '^]'.
220 exchange_server ESMTP Server (Microsoft Exchange Internet Mail Service
5.5.2650.21) ready
(Then type in :
HELO test
250 OK
MAIL from:yourserver ( enter name in)
250 OK - mail from <name displayed>
RCPT TO:your ip address@comp.com
250 OK - Recipient <your ip address@comp.com>
DATA
354 Send data. End with CRLF.CRLF
test message
.
250 OK
quit
221 closing connection
Connection closed.

Then check if you received the mail
Once you can do that , then you can edit sendmail.cf file and where it has the
entry DS add in the exchange server. 

Step three: vi /etc/sendmail.cf file..... look for the DS macro make it look like the following:
DSsmtp:[ipaddress] or DSsmtp:nameofmailserver

i.e.
DSsmtp:exhan_srv 

If you want everything in the world to be sent do the same to DR macro sendmail.cf.htm


save the file

Step four: refresh -s sendmail make sure it is running with lssrc -s sendmail if you get errors kill mail with a kill -15 on the process and restart with
startsrc -s sendmail -a " -bd -q 30m "

Step five
: run newaliases

Step six
: set up user aliases for each user on the other machine....... remember if you set up DR...all mail including root will be transferred...which means unless you have a root user on the other side you will have a lot of dead letters.... Make sure you have an alias for root then if you do it.. Run newaliases again if you need to for your aliases.... aliases

Step seven: mail -v emailaddress and see what happens it should say "connect to mailservername" or something like this if it makes it.....

You need to have an MX record in DNS, and for every user that does not exist on the Exchange server you will need to set up an alias. You may also need to set DNS to "@" (without the hostname in the domane..... or find the invalid ones and add them manaually.

You can also have a $HOME/.forward file to redirect your email for each user if you wish.


Additional Things
* You can define additional mail host by:
- Backing up filename sendmail.cf to sendmail.cf.original under /etc.
- vi sendmail.cf
- Uncomment
#Fw-o /etc/sendmail.cw
- Save and exit vi
- Create filename sendmail.cw under /etc
- Edit sendmail.cw and type/provide additional email host
(your exchange server, maybe)
- Save and exit vi
# refresh -s sendmail
- Check sendmail process using
# ps -ef | grep sendmail (you should be able to see
sendmail : accepting connections on port 25).


Check permissions on some of the required files for sendmail:
/var/spool/mqueue directory should be 770,
Also, /usr/bin/bellmail should be 6555 (r-sr-sr-x),
-r-sr-s--x /usr/sbin/sendmail (chmod 6551)
drwxrwxrwt /tmp
(chmod 1777 /tmp)


Other places to check for Help
Sendmail.cf
aliases
Sendmail.org
FAQ
Features
Antirelay 4.3
Antirelay 5.1
sendmail basics
Configuring Mailserver

(slg03/2002)