maily is designed for batch operations which send notifications via email. Newer versions of the mailx utility contain the same functionality, but older ones do not.

Important features:

  • "-f" flag which allows a From address to be set. "Full Name <username@…>" syntax is allowed.
  • "-mA" flag prevents mail from being sent if body is empty. Used in cron jobs where a notification should only be sent if a command returns output.



  • Perl
  • Mail::Sender

To check out the source code:

svn co

A  fatpacked binary is also available which will only require Perl to run.

To browse the source online,  click here.

To submit a bug report,  click here.

To view existing bug reports,  click here.



usage: ./maily recipient [-c cc] [-b bcc] [-f from] [-s subject] [-m message] [-a /path/to/attachment]
                    [-h host] [-p port]

 recipient  - To email address, required
        -c  - Cc email addresses, default empty list
        -b  - Bcc email addresses, default empty list
        -f  - From email address, default user@host
        -s  - Email subject, default '(untitled)'
        -m  - Message body, '-' to read from STDIN, default '-'
        -mA - abort if message is empty or contains only whitespace
        -mE - enable iterpolation of newlines in message body
        -a  - Path to file attachment, '-' to read from STDIN, default null
              If set to '-', -m parameter is required
        -h  - SMTP server hostname, default localhost
        -p  - SMTP server port, default 25

For example, if you would like to be emailed when your 3ware controller has degraded arrays:

    tw_cli /c0/u0 show | grep RAID | grep -v OK | maily -s "`hostname` - raid event" -f "My Monitoring <>" -mA