How to send mail from zimbra command line
There are two method to send mails command line from zimbra server based on ZCS Roles.
1) Send mail from Zimbra MTA
2) Send mail from mailstore,LDAP,Proxy via Zimbra MTA
Method #1: Send mail from Zimbra MTA
/bin/awk 'BEGIN{print "Subject:zimbra backup status (MTA to NAS) !\nFrom:ms2 <admin@knowledgelinux.com>"}{printf("%s\015\n", $0)}' $LOG | sendmail -t "admin@sahara.in""
Method #2:Send mail from mailstore,LDAP,Proxy via Zimbra MTA
first of all you have to install sshpass to pass your password in single line
#yum install sshpass
/bin/awk 'BEGIN{print "Subject:zimbra backup status (Mailstore2 to NAS) !\nFrom:ms2 <admin@knowledgelinux.com>"}{printf("%s\015\n", $0)}' $LOG |/usr/bin/sshpass -p serverpasswordhere /usr/bin/ssh 172.19.x.x "/opt/zimbra//postfix/sbin/sendmail -t "admin@knowledgelinux.com""
Scripts to Sending bulk mails from Zimbra command line with attachment
#!bin/bash #created by vikas kushwaha message=/tmp/message.txt while read mailid do echo "$mailid done" awk 'BEGIN{print "Subject:test mail!\nFrom:Mailadmin <admin@knowledgelinux.com>"}{printf("%s\015\n", $0)}' $message file-name=/tset.txt | sendmail -t "$mailid" done </tmp/email_list.txt