Server Fault is a question and answer site for system and network administrators. 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 able to send an email using ssmtp using the following command line :

ssmtp < ./textfile.txt

...but I want to send a message from a cron task, and on the fly, without creating the file.

I tried

ssmtp < echo "Text body here..."

but that doesn't work. How do I go about getting the above to work?

I also tried

echo "Text message..." | ssmtp

but to no avail.

share|improve this question

Try something like this.

ssmtp <( echo "Text body here..." )

The <( ) makes the enclosed contents appear as a file descriptor.

share|improve this answer
Doesn't seem to work, the command just goes into input mode. – Josef van Niekerk May 9 '13 at 7:38

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.