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: manager@mail.com  
from: cron@machine**1**.com

Example2:

to: manager@mail.com  
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 manager@mail.com? 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

iletras
  • 432

1 Answers1

2

Edit the file
/etc/aliases

Under # Person who should get root's mail set the recipient with an entry similar to:
root: email@il0veb00b5.xxx

Then run:
newaliases

I think no need to restart postfix...

iletras
  • 432