LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 12-27-2007, 11:12 AM   #1
dbradshaw
LQ Newbie
 
Registered: Dec 2007
Posts: 2

Rep: Reputation: 0
Sending mail between local users (other than root) fails using sendmail


I had a working FC7 system on which I installed the Amanda tape backup. Amanda sends reports to root and I want to re-direct mail to a user “Dave” and then collect Dave’s mail from a Windows machine via Dovecot. When I edit the aliases file to re-direct root’s mail to Dave then root’s mail disappears and does not get delivered to Dave!

It was then that I noticed that I couldn’t send mail between local users i.e. I cannot send mail from ‘root’ to ‘Dave’. This would seem to be the first thing to solve. I do not want to send mail externally and I do not want to receive mail from external servers, I assume that I do not need to configure a domain name (or a host name for that matter) – I have tried various configurations and thoroughly confused myself.

I have therefore configured a new virgin install of Fedora 8 with no changes and it shows the same problem. There is obviously something fundamental that I am missing, all the stuff I have read suggests that if sendmail cannot find a host to forward to it will deliver the mail to the user with the same name on the local machine but I seem to have a problem either with User Unknown or Host Unknown!

Any help or suggestions gratefully received.

Code:
[root@localhost ~]# domainname
(none)
Code:
[root@localhost ~]# hostname
localhost.localdomain
Code:
[root@localhost ~]# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1  localhost.localdomain localhost localhost
::1             localhost6.localdomain6 localhost6

[root@localhost ~]#
sending a mail message to root seems ok
Code:
[root@localhost ~]# echo "test mail" | mail -s Subject root
[root@localhost ~]# mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N  1 root@localhost.local  Thu Dec 27 15:02  16/649   "Subject"
& q
Held 1 message in /var/spool/mail/root
With the verbosity option set this still seems OK
Code:
[root@localhost ~]# echo "test mail" | mail -v -s Subject root
root... Connecting to [127.0.0.1] via relay...
220 localhost.localdomain ESMTP Sendmail 8.14.1/8.14.1; Thu, 27 Dec 2007 15:04:02 GMT
>>> EHLO localhost.localdomain
250-localhost.localdomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From:<root@localhost.localdomain> SIZE=37 AUTH=root@localhost.localdomain
250 2.1.0 <root@localhost.localdomain>... Sender ok
>>> RCPT To:<root@localhost.localdomain>
>>> DATA
250 2.1.5 <root@localhost.localdomain>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 lBRF42cJ003215 Message accepted for delivery
root... Sent (lBRF42cJ003215 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost.localdomain closing connection
You have mail in /var/spool/mail/root
Sending a mail message to Dave however fails and only results in a message to root informing that the mail failed because dave@localhost.localdomain is unknown however the error message can be sent to root@localhost.localdomain successfully.
Code:
[root@localhost ~]# echo "test mail" | mail -v -s Subject Dave
Dave... Connecting to [127.0.0.1] via relay...
220 localhost.localdomain ESMTP Sendmail 8.14.1/8.14.1; Thu, 27 Dec 2007 15:06:15 GMT
>>> EHLO localhost.localdomain
250-localhost.localdomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From:<root@localhost.localdomain> SIZE=37 AUTH=root@localhost.localdomain
250 2.1.0 <root@localhost.localdomain>... Sender ok
>>> RCPT To:<Dave@localhost.localdomain>
>>> DATA
550 5.1.1 <Dave@localhost.localdomain>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
>>> RSET
250 2.0.0 Reset state
root... Using cached ESMTP connection to [127.0.0.1] via relay...
>>> MAIL From:<> SIZE=1061
250 2.1.0 <>... Sender ok
>>> RCPT To:<root@localhost.localdomain>
>>> DATA
250 2.1.5 <root@localhost.localdomain>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 lBRF6FXV003224 Message accepted for delivery
root... Sent (lBRF6FXV003224 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost.localdomain closing connection
You have new mail in /var/spool/mail/root
Sending mail to Dave@localdomain seems more successful (emphasis on ‘seems’)
Code:
[root@localhost ~]# echo "test mail" | mail -v -s Subject Dave@localdomain
Dave@localdomain... Connecting to [127.0.0.1] via relay...
220 localhost.localdomain ESMTP Sendmail 8.14.1/8.14.1; Thu, 27 Dec 2007 15:08:50 GMT
>>> EHLO localhost.localdomain
250-localhost.localdomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From:<root@localhost.localdomain> SIZE=49 AUTH=root@localhost.localdomain
250 2.1.0 <root@localhost.localdomain>... Sender ok
>>> RCPT To:<Dave@localdomain>
>>> DATA
250 2.1.5 <Dave@localdomain>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 lBRF8o2S003269 Message accepted for delivery
Dave@localdomain... Sent (lBRF8o2S003269 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost.localdomain closing connection
[root@localhost ~]#
but Dave has no mail
Code:
[Dave@localhost ~]$ mail
No mail for Dave
[Dave@localhost ~]$
However root has mail
Code:
[root@localhost ~]# mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/root": 6 messages 5 new 6 unread
 U  1 root@localhost.local  Thu Dec 27 15:02  17/659   "Subject"
>N  2 root@localhost.local  Thu Dec 27 15:04  16/649   "Subject"
 N  3 MAILER-DAEMON@localh  Thu Dec 27 15:06  67/2315  "Returned mail: see transcript for details"
 N  4 MAILER-DAEMON@localh  Thu Dec 27 15:08  63/2254  "Returned mail: see transcript for details"
 N  5 MAILER-DAEMON@localh  Thu Dec 27 15:08  62/2244  "Returned mail: see transcript for details"
 N  6 MAILER-DAEMON@localh  Thu Dec 27 15:08  63/2254  "Returned mail: see transcript for details"
&
looking at message 6 shows that the error is Host Unknown – From this I deduce that we can submit mail and Sendmail accepts mail for dave@localdomain but that having accepted the mail it does not know what to do with it.
Code:
--lBRF8o2S003271.1198768130/localhost.localdomain
Content-Type: message/delivery-status

Reporting-MTA: dns; localhost.localdomain
Received-From-MTA: DNS; localhost.localdomain
Arrival-Date: Thu, 27 Dec 2007 15:08:50 GMT

Final-Recipient: RFC822; Dave@localdomain
Action: failed
Status: 5.1.2
Remote-MTA: DNS; localdomain
Diagnostic-Code: SMTP; 550 Host unknown
Last-Attempt-Date: Thu, 27 Dec 2007 15:08:50 GMT

--lBRF8o2S003271.1198768130/localhost.localdomain
Content-Type: message/rfc822

Return-Path: <root@localhost.localdomain>
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
        by localhost.localdomain (8.14.1/8.14.1) with ESMTP id lBRF8o2S003269
        for <Dave@localdomain>; Thu, 27 Dec 2007 15:08:50 GMT
Received: (from root@localhost)
        by localhost.localdomain (8.14.1/8.14.1/Submit) id lBRF8oqu003268
        for Dave@localdomain; Thu, 27 Dec 2007 15:08:50 GMT
Date: Thu, 27 Dec 2007 15:08:50 GMT
From: root <root@localhost.localdomain>
Message-Id: <200712271508.lBRF8oqu003268@localhost.localdomain>
To: Dave@localdomain
Subject: Subject

test mail

--lBRF8o2S003271.1198768130/localhost.localdomain--

looking at /var/log/maillog shows the same
[root@localhost ~]# vi /var/log/maillog
Dec 27 15:08:14 localhost sendmail[3232]: lBRF8E6e003232: to=Dave@localdomain, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30049, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (lBRF8E2v003233 Message accepted for delivery)

Dec 27 15:08:14 localhost sendmail[3235]: lBRF8E2v003233: to=<Dave@localdomain>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120341, relay=localdomain, dsn=5.1.2, stat=Host unknown (Name server: localdomain: host not found)
Dec 27 15:08:14 localhost sendmail[3235]: lBRF8E2v003233: lBRF8E2v003235: DSN: Host unknown (Name server: localdomain: host not found)
Dec 27 15:08:14 localhost sendmail[3235]: lBRF8E2v003235: to=<root@localhost.localdomain>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31590, dsn=2.0.0, stat=Sent
Dec 27 15:08:32 localhost sendmail[3240]: lBRF8W9S003240: from=root, size=39, class=0, nrcpts=1, msgid=<200712271508.lBRF8W9S003240@localhost.localdomain>, relay=root@localhost
Dec 27 15:08:32 localhost sendmail[3241]: lBRF8WTs003241: from=<root@localhost.localdomain>, size=331, class=0, nrcpts=1, msgid=<200712271508.lBRF8W9S003240@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 27 15:08:32 localhost sendmail[3240]: lBRF8W9S003240: to=Dave@localdomain, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30039, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (lBRF8WTs003241 Message accepted for delivery)

Dec 27 15:08:32 localhost sendmail[3243]: lBRF8WTs003241: to=<Dave@localdomain>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120331, relay=localdomain, dsn=5.1.2, stat=Host unknown (Name server: localdomain: host not found)
Dec 27 15:08:32 localhost sendmail[3243]: lBRF8WTs003241: lBRF8WTs003243: DSN: Host unknown (Name server: localdomain: host not found)
Dec 27 15:08:32 localhost sendmail[3243]: lBRF8WTs003243: to=<root@localhost.localdomain>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31580, dsn=2.0.0, stat=Sent
Dec 27 15:08:50 localhost sendmail[3268]: lBRF8oqu003268: from=root, size=49, class=0, nrcpts=1, msgid=<200712271508.lBRF8oqu003268@localhost.localdomain>, relay=root@localhost
Dec 27 15:08:50 localhost sendmail[3269]: lBRF8o2S003269: from=<root@localhost.localdomain>, size=341, class=0, nrcpts=1, msgid=<200712271508.lBRF8oqu003268@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 27 15:08:50 localhost sendmail[3268]: lBRF8oqu003268: to=Dave@localdomain, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30049, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (lBRF8o2S003269 Message accepted for delivery)

Dec 27 15:08:50 localhost sendmail[3271]: lBRF8o2S003269: to=<Dave@localdomain>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120341, relay=localdomain, dsn=5.1.2, stat=Host unknown (Name server: localdomain: host not found)
Dec 27 15:08:50 localhost sendmail[3271]: lBRF8o2S003269: lBRF8o2S003271: DSN: Host unknown (Name server: localdomain: host not found)
Dec 27 15:08:50 localhost sendmail[3271]: lBRF8o2S003271: to=<root@localhost.localdomain>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31590, dsn=2.0.0, stat=Sent
Sendmail.mc shows that sendmail should accept mail for localhost.localdomain which it does.
Code:
[root@localhost ~]# vi /etc/mail/sendmail.mc
dnl #
dnl DAEMON_OPTIONS(`Name=MTA-v4, Family=inet, Name=MTA-v6, Family=inet6')
dnl #
dnl # We strongly recommend not accepting unresolvable domains if you want to
dnl # protect yourself from spam. However, the laptop and users on computers
dnl # that do not have 24x7 DNS do need this.
dnl #
FEATURE(`accept_unresolvable_domains')dnl
dnl #
dnl FEATURE(`relay_based_on_MX')dnl
dnl #
dnl # Also accept email sent to "localhost.localdomain" as local email.
dnl #
LOCAL_DOMAIN(`localhost.localdomain')dnl
dnl #
dnl # The following example makes mail from this host and any additional
dnl # specified domains appear to be sent from mydomain.com
dnl #
dnl MASQUERADE_AS(`mydomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
dnl FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
dnl MAILER(cyrusv2)dnl
When Dave sends mail to Dave something very similar happens
Code:
[Dave@localhost ~]$ echo "test" | mail -v -s Subject Dave
Dave... Connecting to [127.0.0.1] via relay...
220 localhost.localdomain ESMTP Sendmail 8.14.1/8.14.1; Thu, 27 Dec 2007 15:48:46 GMT
>>> EHLO localhost.localdomain
250-localhost.localdomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From:<Dave@localhost.localdomain> SIZE=32 AUTH=Dave@localhost.localdomain
250 2.1.0 <Dave@localhost.localdomain>... Sender ok
>>> RCPT To:<Dave@localhost.localdomain>
>>> DATA
550 5.1.1 <Dave@localhost.localdomain>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
/home/Dave/dead.letter... Saved message in /home/Dave/dead.letter
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost.localdomain closing connection
Code:
[Dave@localhost ~]$ echo "test" | mail -v -s Subject Dave@localdomain
Dave@localdomain... Connecting to [127.0.0.1] via relay...
220 localhost.localdomain ESMTP Sendmail 8.14.1/8.14.1; Thu, 27 Dec 2007 15:51:19 GMT
>>> EHLO localhost.localdomain
250-localhost.localdomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From:<Dave@localhost.localdomain> SIZE=44 AUTH=Dave@localhost.localdomain
250 2.1.0 <Dave@localhost.localdomain>... Sender ok
>>> RCPT To:<Dave@localdomain>
>>> DATA
250 2.1.5 <Dave@localdomain>... Recipient o]
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 lBRFpJH6003453 Message accepted for delivery
Dave@localdomain... Sent (lBRFpJH6003453 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost.localdomain closing connection
[Dave@localhost ~]$ mail
No mail for Dave
 
Old 12-28-2007, 03:30 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
Have you tried sending mail to a local user whose user-name is all lower case? If the username was steve, with a home directory of /home/steve and a mail spool of /var/spool/mail/steve, try sending mail to each of; steve, steve@localhost and steve@localhost.localdomain.

You shouldn't be able to send to localdomain, because it doesn't resolve. According to your hosts file, localhost will resolve and localhost.localdomain will resolve, but that's all.
 
Old 12-28-2007, 04:37 PM   #3
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189

Rep: Reputation: 105Reputation: 105
also, I'm not sure if it didn't get copied correctly or what, but why do you have localhost twice on the 127.0.0.1 line?
 
Old 12-29-2007, 01:06 AM   #4
dbradshaw
LQ Newbie
 
Registered: Dec 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Smile

Nice one gilead, creating a user with a lower case logon name of steve allows me to send mail from root to steve, steve@localhost & steve@localhost.localdomain which as you correctly point out should all resolve to the user steve on the local machine.

Sending mail to Steve, Steve@localhost & Steve@localhost.localdomain and even sTeve all result in mail successfully being delivered to steve. Somewhere there must be a conversion to lowercase to prevent mail being rejected if incorrectly capitalised.

choogendyk - I haven't edited (yet) the hosts file as far as I know so I assume the reason localhost is in there twice is down to the installer.

Thanks both
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail not sending to local user? Julix Linux - General 2 09-07-2007 05:42 PM
Restrict Postfix Users from sending mail to outside the local network gugabaga Linux - Software 4 07-20-2006 06:23 AM
Sendmail sending mail from non-existant users sbms Linux - Security 6 04-05-2006 04:09 PM
Restricting local users from sending external mail (except for one domain) iolames Linux - Newbie 1 03-15-2006 10:57 AM
qmail server, local users sending mail with incorrect email addresses HoundDog Linux - Networking 2 01-04-2006 03:40 AM


All times are GMT -5. The time now is 04:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration