title: Sending mail from a Bash shell script
body: <p>I am writing a <a href="http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29" rel="noreferrer">Bash</a> shell script for Mac that sends an email notification by opening an automator application that sends email out with the default mail account in Mail.app. The automator application also attaches a text file that the script has written to. The problems with this solution are</p>
  
  <ol>
  <li>It is visible in the GUI when sending</li>
  <li>It steals focus if Mail is not the current application</li>
  <li>It is dependent on Mail.app's account setup being valid in the future</li>
  </ol>
  
  <p>I figure to get around those shortcomings I should send the mail directly from the script by entering <a href="http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol" rel="noreferrer">SMTP</a> settings, address to send to, etc. directly in the script. The catch is I would like to deploy this script on multiple computers (10.5 and 10.6) without enabling <a href="http://en.wikipedia.org/wiki/Postfix_%28software%29" rel="noreferrer">Postfix</a> on the computer. Is it possible to do this in the script so it will run on a base Mac&nbsp;OS&nbsp;X install of 10.5. and 10.6?</p>
  
  <p>Update: I've found the <code>-bs</code> option for Sendmail which seems to be what I need, but I'm at a loss of how to specify settings.</p>
  
  <p>Also, to clarify, the reason I'd like to specify SMTP settings is that mails from localhost on port 25 sent out via Postfix would be blocked by most corporate firewalls, but if I specify the server and an alternate port I won't run into that problem.</p>