0

How can a linux box be set up to send service emails from ' "service name" @ "machine id" ' to a non-root email account?

Example1:

to: [email protected]  
from: cron@machine**1**.com

Example2:

to: [email protected]  
from: mdadm@machine**2**.com

Services set up email notices with idiomatic syntax. Checking just

grep -Eir "(MAILADDR|MAILTO|-m)(\ )*(=)?(\ )*root" /etc/*

turns up Recipients:

/etc/anacrontab:MAILTO=root  
/etc/cron.d/0hourly:MAILTO=root  
/etc/crontab:MAILTO=root  
/etc/mdadm.conf:MAILADDR root  
/etc/smartmontools/smartd.conf:DEFAULT -a -n standby,7,q -S on -m root -M exec   /usr/libexec/smartmontools/smartdnotify -n standby,10,q  
/etc/sysconfig/smartmontools:# smartd_conf_opts="-H -m root"

(There probably are other ways - in addition to MAILADDR, MAILTO & -m - that packages name the notification recipient.)

Sender
root?

Is finding/changing those files the way to get them to mail to [email protected]? An account alias maybe?
Is it possible to set the sender to service@machineId?
Is creating a user and/or local mailbox required for "send only"s?

Related:
how to redirect all email to a single external address?
Redirect specific e-mail address sent to a user, to other email-recipients (procmail)

Platform:
Centos 7
postfix

1 Answer 1

2

Edit the file
/etc/aliases

Under # Person who should get root's mail set the recipient with an entry similar to:
root: [email protected]

Then run:
newaliases

I think no need to restart postfix...

3
  • If I understood correctly the question...
    – BiG_NoBoDy
    May 19, 2018 at 19:51
  • The # Person who should get root's mail #root: marc in /etc/aliases followed by newaliases looks like the answer to me @BiG_NoBoDy When I try it out, & it works, I'll credit you and close the q.
    – iletras
    May 19, 2018 at 19:59
  • Cool, happy if it helps
    – BiG_NoBoDy
    May 19, 2018 at 20:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .