title: Java Runtime.exec() not sending emails as from the command line
body: <p>I'm creating a java application and one of the features I would like to add is sending a generated email out to users. I have set up mail on my Macbook and I can send emails from the command line just fine. I'm having an issue sending emails when I call runtime.exec(). Anyone have any idea why it will not execute and send the emails?</p>
  
  <pre><code>Runtime runtime = Runtime.getRuntime();
  
  try {
      runtime.exec("echo This is the body | mail -s Subject -F myemail@gmail.com");
  }
  catch ( Exception e ) {
  
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
  </code></pre>
  
  <p>I don't get any errors and everything compiles fine. I just don't get any emails sent out. If anyone could hel it would be much appreciated thanks.</p>