Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am able to send an email using ssmtp using the following command line :

ssmtp my@email.com < ./textfile.txt

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

I tried

ssmtp my@email.com < 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 my@email.com

but to no avail.

share|improve this question

1 Answer 1

Try something like this.

ssmtp my@email.com <( 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.