I know there is the command mail
in linux to send emails via command line. How can I send an simple email with one line from the terminal though?
For example:
mail user@gmail.com [subject] [body]
And have the email sent without any confirmation or prompts to the user?
The reason is, I want to send a brief message via email to myself when a specific event happens in a java
program. The idea is that I will use Runtime.getRuntime()
… etc. to send the mail command
from my java
program.
I used cron
to do something similar in the past, but the current implementation doesn't use cron
, so I need to try this out instead.