Page 1 of 1

Exim4 delivers mail to mail instead to root

Posted: Tue Apr 13, 2021 10:22 am
by brad
Linux mx-linux 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux

I just wanted to use exim4 instead sendmail or postfix which btw works great.
If anybody can understand and reproduce this issue please help, for the ones who copy and paste from google please refrain, I did search.

I configured local-only (no network):

Code: Select all

dpkg-reconfigure exim4-config
and

Code: Select all

update-exim4.conf
Thanks!

Re: Exim4 fails to deliver mail

Posted: Mon Nov 21, 2022 3:22 pm
by brad
mail is delivered to users but not to root. Instead /var/mail/root all mail is delivered to /var/mail/mail

2022-11-21 14:55:41 1oxCtJ-0009R0-Cd => /var/mail/mail (root@mx-linux) <root@mx-linux> R=mail4root T=address_file

Code: Select all

root@mx-linux:/var/mail# tail /var/log/exim4/mainlog
2022-11-21 14:46:13 End queue run: pid=35890
2022-11-21 14:47:51 1oxClj-0009PG-PK <= root@mx-linux U=root P=local-esmtp S=432 id=a8d4d2d2-66dc-34b-f222-27821553cbe4@mx-linux
2022-11-21 14:47:52 1oxClj-0009PG-PK => /var/mail/mail (root@mx-linux) <root@mx-linux> R=mail4root T=address_file
2022-11-21 14:47:52 1oxClj-0009PG-PK => brad <brad@mx-linux> R=local_user T=mail_spool
2022-11-21 14:47:52 1oxClj-0009PG-PK Completed
2022-11-21 14:55:41 1oxCtJ-0009R0-Cd <= root@mx-linux U=root P=local S=321
2022-11-21 14:55:41 1oxCtJ-0009R0-Cd => /var/mail/mail (root@mx-linux) <root@mx-linux> R=mail4root T=address_file
2022-11-21 14:55:41 1oxCtJ-0009R0-Cd Completed
2022-11-21 15:16:29 Start queue run: pid=38616
2022-11-21 15:16:29 End queue run: pid=38616

Code: Select all

root@mx-linux:/var/mail# ll
total 720
drwxrwsrwt  2 root mail   4096 Nov 21 14:55 ./
drwxr-xr-x 13 root root   4096 Jan 14  2022 ../
-rw-rw----  1 brad mail   4430 Nov 21 14:52 brad
-rw-------  1 mail mail 716127 Nov 21 14:55 mail
-rw-------  1 root mail      0 Oct  8  2021 root
I added mail: root but still delivers to mail

Code: Select all

root@mx-linux:/var/mail# cat /etc/aliases
# /etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
backuppc: root
mail: root

Re: Exim4 deliver mail to mail instead to root

Posted: Mon Nov 21, 2022 6:15 pm
by brad
so what is the workaround folks? Maybe I am not setting the /etc/aliases correctly?

Code: Select all

### router/mmm_mail4root
1446 #################################
1447 # deliver mail addressed to root to /var/mail/mail as user mail:mail
1448 # if it was not redirected in /etc/aliases or by other means
1449 # Exim cannot deliver as root since 4.24 (FIXED_NEVER_USERS)

Re: Exim4 deliver mail to mail instead to root

Posted: Mon Nov 21, 2022 8:31 pm
by FullScale4Me
A quick search gives exim4 cannot send email to root (all localhost users) There are two issues on that page with fixes. There could be more.

Google search term used

Code: Select all

exim4 route to root on localhost

Re: Exim4 deliver mail to mail instead to root

Posted: Mon Nov 21, 2022 9:21 pm
by brad
FullScale4Me wrote: Mon Nov 21, 2022 8:31 pm A quick search gives exim4 cannot send email to root (all localhost users) There are two issues on that page with fixes. There could be more.

Google search term used

Code: Select all

exim4 route to root on localhost
Have you been successful with any of those?

Re: Exim4 delivers mail to mail instead to root

Posted: Mon Nov 21, 2022 10:14 pm
by figueroa
Run newaliases after making changes to your aliases file. Usually, all mail to root is redirected to a real user with a line in aliases like:

Code: Select all

# Put your local aliases here.
root:          user@domain

Re: Exim4 delivers mail to mail instead to root

Posted: Tue Nov 22, 2022 7:58 pm
by brad
figueroa wrote: Mon Nov 21, 2022 10:14 pm Run newaliases after making changes to your aliases file. Usually, all mail to root is redirected to a real user with a line in aliases like:

Code: Select all

# Put your local aliases here.
root:          user@domain
FYI: You don't need to run newaliases on an exim system, it's just provided as a compatibility layer for applications expecting a more "sendmail-like" environment. Exim directly scans the contents of the /etc/aliases file the first time it reads it and caches results, remembering it for subsequent lookups if there are any. It doesn't actually use the /etc/aliases.db file like sendmail does.

Re: Exim4 delivers mail to mail instead to root

Posted: Tue Nov 22, 2022 10:42 pm
by figueroa
Thanks, @brad
I've never actually used exim. I made assumptions. I actually use postfix, courier-imap, procmail with associated tools. I first learned mail under Unix so I'm a dinosaur.