All mail sent to user@localhost using sendmail is received by root

Issues related to applications and software problems
Onnik
Posts: 8
Joined: 2018/03/03 09:12:01

All mail sent to user@localhost using sendmail is received by root

Post by Onnik » 2018/03/03 10:04:50

I'm a Linux student and my online course is teaching me the basics of how to setup and use sendmail.

CentOS is fresh installed and sendmail as well. I added an alias named "admins" to the /etc/aliases file and put my user name "Leon" there to receive mail sent to the alias.

However, when i send an email from root to the alias it is received by root as well.

The output from the terminal;

[root@localhost ~]# mail
No mail for root
[root@localhost ~]# sendmail -v admins < /content.txt
admins... Connecting to [127.0.0.1] via relay...
220 localhost.localdomain ESMTP Sendmail 8.14.7/8.14.7; Sat, 3 Mar 2018 10:42:39 +0100
>>> EHLO localhost.localdomain
250-localhost.localdomain Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH GSSAPI DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From:<Leon@localhost.localdomain> SIZE=41 AUTH=Leon@localhost.localdomain
250 2.1.0 <Leon@localhost.localdomain>... Sender ok
>>> RCPT To:<admins@localhost.localdomain>
>>> DATA
250 2.1.5 <admins@localhost.localdomain>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 w239gdMw004807 Message accepted for delivery
admins... Sent (w239gdMw004807 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost.localdomain closing connection
[root@localhost ~]# mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 Mail Delivery Subsys Sat Mar 3 10:42 65/2365 "Postmaster notify: se"
&

My question from the output is why it says "Leon@localhost" as the sender, while i sent it with user root. User Leon should be the recipient as stated in the aliases file.

Bottom of the aliases file looks like this;
# Person who should get root's mail
#root: marc
admins: Leon


I'm trying to understand what's happening, but i'm puzzled. Any advise is greatly appreciated. Please let me know when more info is needed. Thanks!

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: All mail sent to user@localhost using sendmail is received by root

Post by TrevorH » 2018/03/03 15:40:15

"Postmaster notify: se"
Did you read the mail? From the subject that I can see there, it looks like the mail you sent bounced and came back to postmaster which would end up in root's mailbox via /etc/aliases.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Onnik
Posts: 8
Joined: 2018/03/03 09:12:01

Re: All mail sent to user@localhost using sendmail is received by root

Post by Onnik » 2018/03/03 15:58:10

Hi Trevor,

You could be right. Sorry I read the mail too late. There's the clue;

[root@localhost ~]# mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 Mail Delivery Subsys Sat Mar 3 11:53 65/2365 "Postmaster notify: se"
& 1
Message 1:
From MAILER-DAEMON@localhost.localdomain Sat Mar 3 11:53:00 2018
Return-Path: <MAILER-DAEMON@localhost.localdomain>
Date: Sat, 3 Mar 2018 11:53:00 +0100
From: Mail Delivery Subsystem <MAILER-DAEMON@localhost.localdomain>
To: postmaster@localhost.localdomain
Content-Type: multipart/report; report-type=delivery-status;
boundary="w23Ar0oG006182.1520074380/localhost.localdomain"
Subject: Postmaster notify: see transcript for details
Auto-Submitted: auto-generated (postmaster-notification)
Status: R

Part 1:

The original message was received at Sat, 3 Mar 2018 11:53:00 +0100
from localhost [127.0.0.1]
with id w23Ar0oG006181

----- The following addresses had permanent fatal errors -----
Leon
(reason: 550 5.1.1 User unknown)
(expanded from: <admins@localhost.localdomain>)

----- Transcript of session follows -----
550 5.1.1 Leon... User unknown
550 5.1.1 <Leon@localhost.localdomain>... User unknown

Part 2:
Content-Type: message/delivery-status


Part 3:
Content-Type: message/rfc822

From Leon@localhost.localdomain Sat Mar 3 11:53:00 2018
Return-Path: <Leon@localhost.localdomain>
Date: Sat, 3 Mar 2018 11:53:00 +0100
From: Leon Hermkens <Leon@localhost.localdomain>
Subject: Test
Body: Kijken of het werkt

&
-----------------------------

It says that user Leon is "unknown". That confirms your statement about the mail being bounced.

But how can that be? Any idea's? My user account is named "Leon". How can it be unknown?

Thanks again!

Onnik
Posts: 8
Joined: 2018/03/03 09:12:01

Re: All mail sent to user@localhost using sendmail is received by root

Post by Onnik » 2018/03/03 16:01:53

Ahhhh Sorry i think i see..

I have to use the full name huh? Will try now...

Best,

Leon

Onnik
Posts: 8
Joined: 2018/03/03 09:12:01

Re: All mail sent to user@localhost using sendmail is received by root

Post by Onnik » 2018/03/03 16:06:53

No, sorry i still don't get it...

Any help appreciated

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: All mail sent to user@localhost using sendmail is received by root

Post by TrevorH » 2018/03/03 17:25:30

Perhaps Leon != leon?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Onnik
Posts: 8
Joined: 2018/03/03 09:12:01

Re: All mail sent to user@localhost using sendmail is received by root

Post by Onnik » 2018/03/03 17:42:54

hehe no my skills are not there yet, but that it's capital sensitive i understand.
Thanks

Onnik
Posts: 8
Joined: 2018/03/03 09:12:01

Re: All mail sent to user@localhost using sendmail is received by root

Post by Onnik » 2018/03/04 20:11:32

Hi Trevor- Please have a look at the following when you have some time. I hope it might help..

When i send mail from root to root, the message is received by root and only by root, but the sender of the mail is referred to as Leon@localhost.localdomain

Furthermore in the received message states a "Return-Path" with also a reference to user Leon..
Here's the received mail;

[root@localhost ~]# mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 Leon Hermkens Sun Mar 4 20:57 14/630 "Test"
& 1
Message 1:
From Leon@localhost.localdomain Sun Mar 4 20:57:13 2018
Return-Path: <Leon@localhost.localdomain>
Date: Sun, 4 Mar 2018 20:57:13 +0100
From: Leon Hermkens <Leon@localhost.localdomain>
Subject: Test
Body: Kijken of het werkt
Status: R

&

How is the message sent from Leon@localhost.localdomain when i sent it from root?
Does that shine any new light upon the issue somehow?

Thanks a lot!

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: All mail sent to user@localhost using sendmail is received by root

Post by TrevorH » 2018/03/04 22:37:28

How are you becoming root? What are the changes you've made to /etc/aliases?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Onnik
Posts: 8
Joined: 2018/03/03 09:12:01

Re: All mail sent to user@localhost using sendmail is received by root

Post by Onnik » 2018/03/05 09:31:51

I become root with sudo -i.

I changed the /etc/aliases file to the original state--> removing the "admins: Leon" statement at the bottom.

I decided to skip the aliases step and just try to send mail from root directly to user Leon. Which has the same result as sending it to the alias admins.

Should i be editting some kind of recipients table to add users there? I have been googling and trying a lot..........thanks

Post Reply