Summary: ALthough AIX is by now on version 7.3 I find these old pages so fascinating I decided to keep them. On this page I'll show you how to configure AIX mail. This page is for AIX 5.3 and AIX 6.1.
Date: Between 2010-2013
Refactor: 21 December 2024: Checked formatting.
Because AIX is by default delivered with sendmail, and cronjobs results are delivered to the associated users mailbox here is some information about AIX sendmail and how to deal with the day-to-day administration.
In case you have a working email system configured on your box, this is how you actually send mail:
Note: I replaced the @ in the mail addresses by a _ because of spam. Use correct email addresses
/home/sjoerd>mail -s "testsubject" sjoerd_getshifting.com Test body . Cc:
You can mail logfiles for example by catting them into the mail:
/home/sjoerd>cat smit.log | mail -s "logfile" sjoerd_getshifting.com
Add email addresses to the mail command:
/home/sjoerd>cat smit.log | mail -s "logfile" sjoerd_getshifting.com info_getshifting.com sjoerd.hooft_getshifting.com
The first thing I always do is create a forward for all local mail. This has the benefits that you can redirect the mail to a managed email environment like, for example, groupwise or exchange. Than you can set rules on them, view them everywhere in the world, deliver them to standby email enabled phones like blackberry and much much more. Also, it will (just a little though) lower the required I/O and storage for the user. We
To forward local mail create a new file named “.forward” (the leading period is mandatory) in the users home directory:
sjoerd@server:/home/sjoerd>cat .forward sjoerd_getshifting_com
Note: Fill in an existing email address of course, this is where the mail will be send.
# my official domain name # ... define this only if sendmail cannot automatically determine your domain #Dj$w.Foo.COM Djshift.local # "Smart" relay host (may be null) DS10.10.10.10
# privacy flags O PrivacyOptions=goaway
This setting makes sendmail less secure but could be necessary when you get warnings like this:
4 mail mail warning message forwarded from appserver: sendmail[430420]: o916t011168410: forward /var/data/appuser/.forward: world writable directory 01 Oct 2010, 08:55:00 5 mail mail warning message forwarded from appserver: sendmail[430420]: o916t011168410: forward /var/data/appuser/.forward.appserver: world writable directory 01 Oct 2010, 08:55:00 6 mail mail warning message forwarded from appserver: sendmail[430420]: o916t011168410: forward /var/data/appuser/.forward+: world writable directory 01 Oct 2010, 08:55:00 7 mail mail warning message forwarded from appserver: sendmail[430420]: o916t011168410: forward /var/data/appuser/.forward.appserver+: world writable directory
as well as these warnings but then for “group writable directory”.
Some more information about this:
The biggest surprise is likely to come from .forward and :include: files in unsafe directory paths (directory paths which are group or world writable). This is no longer allowed. This would mean that if user joe's home directory was writable by group staff, sendmail would not use his .forward file. This behavior can be altered, at the possible expense of system security, by setting the DontBlameSendmail option. Items from these unsafe .forward and :include: files will be marked as unsafe addresses – the items can not be deliveries to files or programs. This behavior can also be altered via DontBlameSendmail.
I've set:
O DontBlameSendmail=forwardfileinunsafedirpath, forwardfileinunsafedirpathsafe
The first flag allows the forward file to be read, the second allows the items in the file to be marked as safe for file and program delivery.
startsrc -s sendmail -a "-bd"
stopsrc -s sendmail
stopsrc -s sendmail; startsrc -s sendmail -a "-bd"
echo \$Z | /usr/sbin/sendmail -bt -d0
cd /var/spool/mail vi username :%d :wq
mail
d *
f *
: DISPLAY headers> mail -s "test" sjoerd_getshifting_com test . Cc: > cat shell_func.sh function mail_att_to_me() { (for k in ${1}; do uuencode $k ${k##*/}; done) | \ mailx -r sjoerd-noreply_getshifting_com -s "Attachment(s) for me" sjoerd_getshifting_com }