3

As a Solaris user, I want cron jobs generated emails for the localuser@server to be forwarded to my myuser@sample.com email account, so that I read only one inbox.

To resolve this I have forwarded localuser to myuser@sample.com and according to the aliases test it does work as expected:

 $ sudo sendmail -v -bv localuser
 Password: 
 localuser... aliased to myuser@sample.com

The mconnect command also confirms the alias is set.

However any communication from cron seems to not use aliases:

Mar 14 17:54:27 localuser sendmail[9249]: [ID 801593 mail.info] s2ELsRC2009249: from=localuser, size=13, class=0, nrcpts=1, msgid=<201403142154.s2ELsRC2009249@myserver.sample.com>, relay=localuser@localhost

Mar 14 17:54:28 localuser sendmail[9249]: [ID 801593 mail.info] s2ELsRC2009249: to=localuser, ctladdr=localuser (100/1), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30013, relay=smtp.sample.com. [192.168.0.2], dsn=2.0.0, stat=Sent ( <201403142154.s2ELsRC2009249@myserver.sample.com> Queued mail for delivery)

This results in errors of course in smtp.sample.com as user localuser does not exist there.

Any ideas how can I debug what is happening?

1

As posted in http://thinkinginsoftware.blogspot.com/2014/06/devops-need-no-words-but-code-how-to.html here is the answer. I know ot is not recommended to edit *cf files directly so you know the drill. Hopefully it will help somebody out there.

smarthost=mail.sample.com
user=me
alertlist=alert@mail.sample.com
/opt/csw/bin/gsed -i "s/^DS[\s]*.*/DS $smarthost/g" /etc/mail/submit.cf
/opt/csw/bin/gsed -i "s/^DS[\s]*.*/DS $smarthost/g" /etc/mail/sendmail.cf
/opt/csw/bin/gsed -i "/$user:/d" /etc/aliases
echo "$user:$alertlist" >> /etc/aliases
/opt/csw/bin/gsed -i "/root:/d" /etc/aliases
echo "root:$alertlist" >> /etc/aliases
svcadm restart sendmail
echo "So that we never miss again an important communication from servers" | mailx  -s "`hostname` As a sysadmin I want to receive my user mail notifications in my personal email address" me
echo "So that we never miss again an important communication from servers" | mailx  -s "`hostname` As a sysadmin I want to receive root mail notifications in my personal email address" root

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.