0

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.

Josef van Niekerk
  • 511
  • 4
  • 8
  • 15

1 Answers1

0

Try something like this.

ssmtp my@email.com <( echo "Text body here..." )

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

Zoredache
  • 130,897
  • 41
  • 276
  • 420