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