Getting nightly cron jobs to send mail to a good account...

Ok.. Next odd problem that I can't figure out.. I've not received any of the nightly cron jobs but see them stuck in the /var/spool/clientmqueue directory:

Code:
mtp# ls -la /var/spool/clientmqueue/
total 72
drwxrwx---   2 smmsp  smmsp  1024 Mar 11 23:41 .
drwxr-xr-x  10 root   wheel   512 Mar  6 14:44 ..
-rw-rw----   1 smmsp  smmsp   835 Mar  9 03:01 dfn29A1W8k010375
-rw-rw----   1 smmsp  smmsp  1905 Mar  9 03:01 dfn29A1X8Q010421
-rw-rw----   1 smmsp  smmsp  3384 Mar  9 07:04 dfn29E4JBm013954
-rw-rw----   1 smmsp  smmsp  2317 Mar  9 07:04 dfn29E4JBn013954
-rw-rw----   1 smmsp  smmsp   443 Mar 10 03:01 dfn2AA1PGR029434
-rw-rw----   1 smmsp  smmsp  2242 Mar 10 03:01 dfn2AA1QlC029478
-rw-rw----   1 smmsp  smmsp  3726 Mar 10 07:04 dfn2AE4JBm033077
-rw-rw----   1 smmsp  smmsp  1930 Mar 10 07:04 dfn2AE4JBn033077
-rw-rw----   1 smmsp  smmsp  2153 Mar 11 03:01 dfn2BA1lY7005900
-rw-rw----   1 smmsp  smmsp  2634 Mar 11 03:01 dfn2BA1mxx005944
-rw-rw----   1 smmsp  smmsp  4118 Mar 11 07:07 dfn2BE7V4P009551
-rw-rw----   1 smmsp  smmsp  3640 Mar 11 07:07 dfn2BE7V4Q009551
-rw-rw----   1 smmsp  smmsp   701 Mar 11 23:40 qfn29A1W8k010375
-rw-rw----   1 smmsp  smmsp   698 Mar 11 23:40 qfn29A1X8Q010421
-rw-rw----   1 smmsp  smmsp   933 Mar 11 23:40 qfn29E4JBm013954
-rw-rw----   1 smmsp  smmsp   933 Mar 11 23:40 qfn29E4JBn013954
-rw-rw----   1 smmsp  smmsp   701 Mar 11 23:40 qfn2AA1PGR029434
-rw-rw----   1 smmsp  smmsp   698 Mar 11 23:40 qfn2AA1QlC029478
-rw-rw----   1 smmsp  smmsp   933 Mar 11 23:40 qfn2AE4JBm033077
-rw-rw----   1 smmsp  smmsp   933 Mar 11 23:40 qfn2AE4JBn033077
-rw-rw----   1 smmsp  smmsp   701 Mar 11 23:40 qfn2BA1lY7005900
-rw-rw----   1 smmsp  smmsp   698 Mar 11 23:40 qfn2BA1mxx005944
-rw-rw----   1 smmsp  smmsp   933 Mar 11 23:40 qfn2BE7V4P009551
-rw-rw----   1 smmsp  smmsp   933 Mar 11 23:40 qfn2BE7V4Q009551
-rw-------   1 smmsp  smmsp    51 Mar 11 23:41 sm-client.pid

I've got the following in my /etc/aliases file:

Code:
...
# Pretty much everything else in this file points to "root", so
# you would do well in either reading root's mailbox or forwarding
# root's email from here.

# root: me@my.domain
root: rickf
...

Now, I see the following in my /var/mail/maillog after restarting sendmail:

Code:
Mar 11 23:40:53 smtp sm-msp-queue[48570]: n2AE4JBn033077: to=root, delay=1+16:36:34, xdelay=00:00:00, mailer=relay, pri=7051861, relay=mydomain.com., dsn=4.0.0, stat=Deferred: Connection refused by mydomain.com.
Mar 11 23:40:53 smtp sm-msp-queue[48570]: n2AE4JBm033077: to=root, delay=1+16:36:34, xdelay=00:00:00, mailer=relay, pri=7053657, relay=mydomain.com., dsn=4.0.0, stat=Deferred: Connection refused by mydomain.com.
Mar 11 23:40:53 smtp sm-msp-queue[48570]: n2AA1QlC029478: to=root, ctladdr=root (0/0), delay=1+20:39:27, xdelay=00:00:00, mailer=relay, pri=7862297, relay=mydomain.com., dsn=4.0.0, stat=Deferred: Connection refused by mydomain.com.
Mar 11 23:40:53 smtp sm-msp-queue[48570]: n2AA1PGR029434: to=root, ctladdr=root (0/0), delay=1+20:39:28, xdelay=00:00:00, mailer=relay, pri=7950501, relay=mydomain.com., dsn=4.0.0, stat=Deferred: Connection refused by mydomain.com.
Mar 11 23:40:53 smtp sm-msp-queue[48570]: n29E4JBn013954: to=root, delay=2+16:36:34, xdelay=00:00:00, mailer=relay, pri=11462251, relay=mydomain.com., dsn=4.0.0, stat=Deferred: Connection refused by mydomain.com.
Mar 11 23:40:53 smtp sm-msp-queue[48570]: n29E4JBm013954: to=root, delay=2+16:36:34, xdelay=00:00:00, mailer=relay, pri=11463318, relay=mydomain.com., dsn=4.0.0, stat=Deferred: Connection refused by mydomain.com.
Mar 11 23:40:53 smtp sm-msp-queue[48570]: n29A1X8Q010421: to=root, ctladdr=root (0/0), delay=2+20:39:20, xdelay=00:00:00, mailer=relay, pri=12271960, relay=mydomain.com., dsn=4.0.0, stat=Deferred: Connection refused by mydomain.com.
Mar 11 23:40:53 smtp sm-msp-queue[48570]: n29A1W8k010375: to=root, ctladdr=root (0/0), delay=2+20:39:21, xdelay=00:00:00, mailer=relay, pri=12360893, relay=mydomain.com., dsn=4.0.0, stat=Deferred: Connection refused by mydomain.com.

Anyway, I'd either like to figure out why it's still trying to deliver to "root" instead of "rickf" as indicated in the aliases (yes, I did run 'newaliases' after the updates to that file) or force the logs to be delivered to me directly.. Any ideas?

P.S. My sendmail is running within a jail and the hostname of the jail is "smtp.mydomain.com" -- perhaps that's why it's confused -- as smtp.mydomain.com is != mydomain.com...?
 
First of all: mail already in the queue will not change its destination no matter how you change the aliases file (hmm, thinking about it, it doesn't matter as alias expansion is done at delivery time - so just forget this part).

Second: your maillog indicates that the MTA has trouble when trying to deliver mail to the domain 'mydomain.com'. This is your main trouble - fix that first.

Now, there can be many reasons why mail delivery doesn't work - you'll have to investigate yourself and figure it out.
Here are a few pointers:
1) the default MTA configuration on FreeBSD will deliver to the host it is running on, as long as that host have a resolvable name. If the host have a blank hostname, or the hostname doesn't resolve to an ip address, mail delivery will not work.
2) if you want a specific host to be the mail server for your domain, you will need a dns zone for that domain, with MX record(s) pointing to that specific server. This is you case, with 'mydomain.com' and 'smtp.mydomain.com'. Oh, and the hosts must be configured to use that dns server, of course.

3) Firewalla and jails can block network traffic, thus stopping mail from being delivered.

HTH
 
Thanks Tingo.. In my case, I'm finding that each nights run of cron email is getting plopped into the stuck queue (I'm reading it the old fashioned way -- with 'more').

All mail from outside is delivered just fine.. Only the internal deliveries to 'root' seem to be problems.. My domain is resolvable back to the domain with the mail server running so that should not be an issue..

I guess I'll have to dig thru the sendmail testing docs so try out the settings.. Obviously Sendmail thinks that the 'root' account is remote.. Wait a minute.. I think I understand what might be happening.. The nightly cron jobs are probably running in the 'host' environment (not the jail) -- correct? If that's the case then perhaps it's the sendmail on that side that is getting horked up...? I'll have to see whether the stuck mail was in the jail or the host and go from there.. Hmm..
 
OK.. I know whats going on now.. The 'host' (non-jail) portion is sending the emails to "root" and they're being delivered locally to the host machine instead of being forwarded to the 'real' mail server (aka smtp.mydomain.com).

So.. Anyone know of a way to force the host version of Sendmail to ALWAYS forward any mail to smtp.mydomain.com and not even bother with trying local mail delivery? Thx!
 
Back
Top