LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-04-2015, 06:17 AM   #1
RagingRaven
Member
 
Registered: Sep 2011
Location: Oud-Beijerland, The Netherlands
Distribution: Mageia 4
Posts: 52

Rep: Reputation: Disabled
Question sendmail alias not working


I'm trying to send all root's mails to an external e-mailaddress, but for some reason I can't get it to work.

I've edited /etc/aliases with the following rule:

root: <myexternal@email.address>

and run newaliasses after, which would run without any errors.

I can run: echo "Testing" | mail -s "Server Testing" <myexternal@email.address>
just fine without any issue and it's being delivered correctly to my external address.

But when I run: echo "Testing" | mail -s "Server Testing" root

I (first) get a "Deferred: 451 Temporary local problem - please try again later" error and when I then run: "Sendmail -OTimeout.hoststatus=0m -q -v" to flush the mailqueue it says everything is ok, but I then get a message saying I have new mail in /var/spool/mail/root and I don't get the mail on my external e-mailaddress.

I have no clue where to look next, hopefully you guys can point me in the right direction.

Just for completeness: I use mageia release 4 (x86_x64).
 
Old 04-04-2015, 08:36 AM   #2
RagingRaven
Member
 
Registered: Sep 2011
Location: Oud-Beijerland, The Netherlands
Distribution: Mageia 4
Posts: 52

Original Poster
Rep: Reputation: Disabled
I'm not sure if linux newbie is the right place for this topic ?
It seems it's more than a simple question, seeing as nobody responded yet?
 
Old 04-07-2015, 02:25 AM   #3
RagingRaven
Member
 
Registered: Sep 2011
Location: Oud-Beijerland, The Netherlands
Distribution: Mageia 4
Posts: 52

Original Poster
Rep: Reputation: Disabled
Hmm...nobody?

I thought there might be an issue with the hosts file, where I gave my localhost a name in the same domain as the domain I wanted to send my mail to.
So I changed this to another name to check and the Deferred message no longer showed, but the mails still don't go to the external address, but get deliverd locally.

It almost seems as though my alias file is totally ignored.
 
Old 04-07-2015, 03:10 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,643

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
Quote:
It almost seems as though my alias file is totally ignored.
Could be that you're editing the wrong aliases file.
Check whether you're running indeed sendmail and it's not using /etc/mail/aliases, or you're running the postfix sendmail replacement in which case it uses /etc/postfix/aliases
 
Old 04-07-2015, 03:32 AM   #5
RagingRaven
Member
 
Registered: Sep 2011
Location: Oud-Beijerland, The Netherlands
Distribution: Mageia 4
Posts: 52

Original Poster
Rep: Reputation: Disabled
Thanks for answering.

I'm pretty sure it's sendmail, but I checked just to be sure:

man postfix: no manual entry for postfix
man sendmail: opens sendmail manual

which sendmail: /usr/sbin/sendmail

updatedb (to make sure my locate database is up to date)
locate main.cf -> no results
locate sendmail.cf -> /etc/mail/sendmail.cf

So it appears it is indeed sendmail, but seeing as you were pointing to /etc/mail/aliases instead of /etc/aliases and the sendmail.cf file is also in /etc/mail/ I went and had a look.

In the folder /etc/mail/ there is no aliases file so I did a locate aliases -> the only file I see that has anything to do with mail is /etc/aliases and /etc/aliases.db

So from what I gather, I'm using the right file.
I did read somewhere that aliases only work when using the sendmail daemon, but the linked topic no longer works, so I have no idea if this has anything to do with it?
edit: read some more, but from what I gather sendmail should run as daemon per default (it shows up when doing ps aux | grep sendmail).

Last edited by RagingRaven; 04-07-2015 at 03:54 AM.
 
Old 04-07-2015, 04:05 AM   #6
RagingRaven
Member
 
Registered: Sep 2011
Location: Oud-Beijerland, The Netherlands
Distribution: Mageia 4
Posts: 52

Original Poster
Rep: Reputation: Disabled
Ok so I tried using a .forward file in the user folder and this works so I've at least got a working situation.

But it seems more of a workaround rather than an actual solution, so I'd appreciate it if somebody could still help me figure this out.
 
Old 04-07-2015, 04:06 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,643

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
Have a look in /etc/mail/sendmail.cf for the AliasFile option, that gives the actual aliases file
 
Old 04-07-2015, 04:11 AM   #8
RagingRaven
Member
 
Registered: Sep 2011
Location: Oud-Beijerland, The Netherlands
Distribution: Mageia 4
Posts: 52

Original Poster
Rep: Reputation: Disabled
sendmail.cf says:
AliasFile=/etc/aliases

To me it seems everything points to the aliases.db not being updated or being ignored.
Especially since forwarding with a .forward does work.

Is there a way to see what is inside the aliases.db file? because a normal editor doesn't work (obviously).

Last edited by RagingRaven; 04-07-2015 at 04:14 AM.
 
Old 04-07-2015, 05:12 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,643

Rep: Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539Reputation: 1539
What is the output of
Code:
sendmail -bv root
Quote:
Is there a way to see what is inside the aliases.db file? because a normal editor doesn't work (obviously).
You can use
Code:
makemap -u hash /etc/aliases.db
 
Old 04-07-2015, 05:24 AM   #10
RagingRaven
Member
 
Registered: Sep 2011
Location: Oud-Beijerland, The Netherlands
Distribution: Mageia 4
Posts: 52

Original Poster
Rep: Reputation: Disabled
sendmail -bv root:
<myexternal@e-mail.address>... deliverable: mailer esmtp, host <myexternal.domain>.. user <myexternal@e-mail.address>

obviously <myexternal@e-mail.address> is my actuall address without the <> and <myexternal.domain> is the corresponding domain.

So that looks ok to me.

makemap -u hash /etc/aliases.db shows no entry for my external address, so now we are getting somewhere.

it seems 'newaliases' isn't updating aliases.db
 
Old 04-07-2015, 05:33 AM   #11
RagingRaven
Member
 
Registered: Sep 2011
Location: Oud-Beijerland, The Netherlands
Distribution: Mageia 4
Posts: 52

Original Poster
Rep: Reputation: Disabled
Just to be sure I reran newaliases, but nothing updated to aliases.db

I don't know why, but I created a fresh aliases file, added every relevant line and ran newaliases again.
Now it seems my address got added.

I've no idea why it wouldn't do it in the old file, because the root: <myaddress> line is exactly the same in both files, so it almost seems as if it got corrupted somehow.

Doesn't really matter, it works!
Thanks bathory for pointing me in the right direction!
 
  


Reply

Tags
alias, mageia, sendmail


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
sendmail alias jshanker.verma Linux - Newbie 0 08-30-2013 11:44 AM
[SOLVED] sendmail to exchange alias bino25 Linux - Newbie 2 11-14-2011 10:12 AM
restricted alias in sendmail davidstvz Linux - Newbie 1 10-28-2008 12:00 PM
sendmail - alias sent from field lord-fu Linux - Server 1 04-18-2007 10:14 AM
Sendmail alias problem ptclinuxsa Linux - General 1 01-16-2006 08:23 PM


All times are GMT -5. The time now is 01:24 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration