Home > Documentation > Zimbra > How to mail from the shell

How to mail from the shell

Posted by peter on October 26, 2011

Sometimes you want to mail from the shell prompt (command prompt). For example, you would like to automatically mail a notification that the backup of your Zimbra server was successful.

First install mutt

yum install mutt

create a file in your home directory (root home dir, if you will mail as root) called ".muttrc"

vi  /root/.muttrc

Make sure the file contains the info related to your Zimbra server as per example below:

--------------------example----------------------------------------

set spoolfile=imaps://yourdomain.co.za/Inbox
set folder=imaps://yourdomain.co.za/
set imap_user=peterh
set record=imaps://yourdomain.co.za/Sent
set postponed=imaps://yourdomain.co.za/Drafts
set sendmail=/opt/zimbra/postfix/sbin/sendmail

-----------------example end---------------------------------------

to mail from the shell prompt use the following command (change as needed):

/usr/bin/mutt -s "subject" -a /tmp/body.txt peterh@thedomain.co.za < /backup/message.txt

This command to send mail can be included in a script.

Comments:

Leave a Reply



(Your email will not be publicly displayed.)

Please type the letters and numbers shown in the image.Captcha CodeClick the image to see another captcha.