Sending an automatic mail using bash + mail
Hello, I want to make a shell (bash) script that automatically sends me a message without an user interaction.
I tried: mail root -s "Hello you" but then the program absolutely wants that I hit 2 times on the enter key... is there a way to tell bash to make a "return to the line" or a better way to do this? |
echo hello|mail -s test "Hi dere"
and hello will appear in the message body, you can also do this with cat to read a file or just about any prog that outputs text that youd like mailed EDIT: should have been echo hello|mail -s "Hi dere" user@host I can cut and paste much faster than I can think :) |
AFAIK it's "cat <sometext>|mail -s "<subject>" <mail@address>"
Btw, you can also send MIME attachments using "mpack" instead of "mail". |
It works great so, thank you all for your quick answers :-)
|
A bit late but ...
mail some@address.here < textfile |
All times are GMT -5. The time now is 07:10 PM. |