Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a script to check whether all the servers in my organization are functioning properly. One of those is Zimbra mail server. I am trying to send a mail through sendmail provided by zimbra package using the following command

ssh Jarvice@someip echo "Hello" | /opt/zimbra/postfix- someuser@gmail.com

But I am unable to do so. I think I am making some mistake in the

echo "Hello" | /opt/zimbra/postfix- someuser@gmail.com

part. But I don't know what it is. Can someone tell me the correct way to do so? Since I am doing this through a script, I have made sure that I can ssh without providing the password. I wish to fully automate the process.

share|improve this question
up vote 8 down vote accepted

Your local shell is dividing your command into ssh ... and /opt/zimbra ..., and then piping the two.

You have to quote the argument to ssh, so your local shell won't try to interpret it and it will be sent to the remote computer in its entirety:

ssh Jarvice@someip "echo \"Hello\" | /opt/zimbra/postfix- someuser@gmail.com"
share|improve this answer

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
/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""

For more information see below link http://www.knowledgelinux.com/how-to-send-mail-from-zimbra-command-line/

share|improve this answer
There isn't any text below the link (as in see below the table). Did you mean "see the following link"? – Anthon Sep 28 '15 at 12:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.