Mutt can be used to send email from command line, for that we do something like:

   mutt -s "Subject" -i file.txt -- someone@gmail.com < /dev/null

My file.txt can have the output of a command like

date > file.txt

How to I skip the part of generating file.txt and put the output of date directly on the mutt command?


You can pass standard input as a body message to mutt:

date | mutt -s "Subject" -- toto@example.com
  • I want to pass a command output, instead. For example, pass the output of date. Can I pass the output of date instead of standard input? – KcFnMi Jul 2 '20 at 13:54
  • 1
    @KcFnMi: the stdout of the date command is piped to stdin of mutt. That’s exactly what you want. – Jakub Jindra Jul 4 '20 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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