Sendmail tricks

root's picture

- How to add/edit email aliases:
This is useful when you have to send a report to many emails and you don't want to stress out too much the command line.
For example, you need to send email to asd@domain.com, fred@domain.com and dust@domain.com.

You open /etc/mail/aliases in your favorite editor and add the following line:
reporting: asd@domain.com, fred@domain.com, dust@domain.com

Save the file and execute the command newaliases (or sendmail -bi):

gzaix@root:/etc/mail # newaliases
WARNING: Group writable directory /var/spool
WARNING: Group writable directory /var/spool/mqueue
/etc/mail/aliases: 8 aliases, longest 121 bytes, 374 bytes total

Now your command line will be much simpler:
/some/script.sh | mail -s "Reporting of the script.sh" [color=green]reporting[/color]

PS: this was done on AIX but it should work on all distributions.

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root