Sendmail Starting up Slow and Funny Mail Box Locations

Vision
Vision used Ask the Experts™
on
I started this thread in another question, but moved it here so someone could get points for it:
Like my root mail is going to a user account (one & the same) and it took about 5 minutes for my sendmail to activate.  Which seems like a long time.

This comment was replied to by 'jlevie':
If it is taking sendmail a while to start, that probably means that the hostname of the system doesn't look like a Fully Qualified Domain Name (FQDN) and that a reverse lookup of the IP of the machine doesn't return an FQDN.

Sendmail must see a hostname that contains at least one '.', which it takes to be an FQDN. If the hostname doesn't look like an FQDN, and DNS is enabled, it will try to find out what the FQDN is by doing a reverse lookup on the IP that it is listening on. If the DNS that the system is configured to use doesn't have a PTR record for the IP you have to wait for the request to time out (typically 120 seconds or a multiple thereof).

The solution to this is simple, either add a PTR record in the DNS, or make sure that 'hostname' returns something with at least one '.'.

I'm not sure what you mean by "root mail is going to a user account (one & the same)". In a stock 8.0 installation the aliases file doesn't re-direct root's mail anywhere. You can change that by editing /etc/aliases and changing:

# Person who should get root's mail
#root:          marc

to something like:

# Person who should get root's mail
root:          some-user

Then run newaliases to update the map.

--- (And now we start) ---
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Okay.  Great, this is a good start.  My hostname does not contain a '.', but i'm not sure where the hostname is located.  (I'm searching now, but I don't have that information off the top of my head)

And as far as the mail-box redirection goes.  Um,
I'm using Mutt to read my mail.  When user Root opens up Mutt it access /var/spool/mail/Vision.
I'm not sure why its not trying to do /var/spool/mail/root or something more like that.  Maybe its a problem with Mutt?
-Vision

Author

Commented:
Okay, I changed my hostname in:
/etc/sysconfig/network
but how do I get the RH system to update it?
Top Expert 2005
Commented:
I was just about to tell you to change that file, but you figured it out... Good!

You can change the hostname from the command line with "hostname my-name.whatever". Then restart sendmail and it should come up normally.

When reading root's mail I'm guessing that you are logging in as Vison and then su'ing to root. To read root's mail you have to actually login as root. To avoid having to do that I normally alias root to myself in /etc/aliases.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Author

Commented:
Ahh, you are amazing!  I added the '.' to the hostname and sendmail shot right up.  Fantastical!

And yes, I was logged in as Vision and SU'd to root.  So I decided to pop out and re-log back in as root.  And its attempting to pull up the right file (/var/spool/mail/root) but it says "no such file or directory (error=2)".
And its true, root has not mailbox that I can see.  Any thoughts on this one ?
-Vision

Author

Commented:
Ahh, you are amazing!  I added the '.' to the hostname and sendmail shot right up.  Fantastical!

And yes, I was logged in as Vision and SU'd to root.  So I decided to pop out and re-log back in as root.  And its attempting to pull up the right file (/var/spool/mail/root) but it says "no such file or directory (error=2)".
And its true, root has not mailbox that I can see.  Any thoughts on this one ?
-Vision
Top Expert 2005

Commented:
If there's not a /var/spool/mail/root file, then nothing has yest been sent to root's eamil address. and that's not surprising since sendmail wasn't running. You can always send root some mail, like:

mail root
wilowisp# mail root
Subject: A test
yep...

End the messsage with two Ctrl-D's.

Author

Commented:
I used this command:
sendmail root < data.txt
It still doesn't seem to work.  I can send mail to myself outside the network (like to work), but not to root.
-Vision
Top Expert 2005

Commented:
Have you checked the aliases file?

Were there any errors when you attempted to send the mail?

Also check /var/log/maillog to see what happened.

Author

Commented:
This is what I get from the -v command:
---------------------------------------------------------[root@hostnamehere root]# sendmail -v root < data.txt
root... Connecting to localhost.localdomain. via relay...
220 hostnamehere ESMTP Sendmail 8.12.5/8.12.5; Mon, 18 Nov 2002 14:12:53 -0700
>>> EHLO hostnamehere
250-hostnamehere Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<root@hostnamehere> SIZE=1275
250 2.1.0 <root@hostnamehere>... Sender ok
>>> RCPT To:<root@hostnamehere>
>>> DATA
250 2.1.5 <root@hostnamehere>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 gAILCrsR004337 Message accepted for delivery
root... Sent (gAILCrsR004337 Message accepted for delivery)
Closing connection to localhost.localdomain.
>>> QUIT
221 2.0.0 hostnamehere closing connection
[root@hostnamehere root]#
---------------------------------------------------------
Inside the maillog I see this:
Nov 18 14:12:58 hostname sendmail[4339]: gAILCrsR004337: to=<root@localhostname>, delay=00:00:04, xdelay=00:00:04, mailer=relay, pri=30282, relay=relayservernamehere. [63.240.76.7], dsn=2.0.0, stat=Sent (Message received: 20021118210520.onelongadress@localhostname)
---------------------------------------------------------
Top Expert 2005

Commented:
Is 'relayservername' the same as 'localhostname'? And if not have you configured sendmail to use a SMART HOST for outgoing email?

As a guess I'd say that your copy of sendmail isn't configured to handle mail for itself. That can be done by adding:

localhost
my-hostname

to /etc/mail/local-host-names and restarting sendmail.

Author

Commented:
Hmmm, I added localhost, localhost.localdomain, putcomputernamehere to the the local-host-names file and restarted the file but it didn't seem to help.
I went ahead an copied oen of the mailboxes that was working over and mutt reads it okay, but for some reason root doesn't seem to want to accept messages, could there be a switch that I'm missing?
-Vision
ps. I did have the Smart Host set-up but I went ahead and disabled it, recompiled it (m4) and restarted the sendmail server.
Top Expert 2005

Commented:
I syspect that you still don't have the local-host-names file right. It must reflect all of the names that the local machine is known by. So if I had a machine who's hostname command returned chaos.mystery.tld, in local-host-names I'd need:

localhost
mystery.tld
chaos.mystery.tld

Note that things can get confusing if a dial up style internet connection is used. In that case the IP of the machine (and it's hostname) will change after sendmail starts.

Author

Commented:
Hmmm, based off of the hostname all those entries are in my local-host-names file.  One weird thing is that ealier I could sendmail to myself (root -> user) and it was working, now that's not working either.  Could this have something to do with my adding a '.' in my hostname?
-Cory

Author

Commented:
Okay, I figured it out.  It looks like once I went to a more formally qualified domain type name (xxxx.xxxx.xxxx) it actually tried to resolve the name even though it was in my local name list.
I went ahead and did a reverse DNS to see what the machine is named and used that.  That seemed to clear it right up and now everything comes up fast (sendmail) and it can send e-mails to itsself.
Thanks a lot for your efforts, they are much appreceated!

Author

Commented:
If any one is looking this over, read through the rest of the comments!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial