title: How do I send a mail via mailx & subprocess?
body: <p>I am EE, trying to write a script to simplify file checks using Python.</p>
  <p>For some reason, our IT will not let me gain access to our SMTP server, and will only allow sending mail via <code>mailx</code>.
  So I've thought of running <code>mailx</code> from Python and send it, in the same way that it works in my console. Alas, it gives an exception. See Linux log below:</p>
  <pre><code>Python 3.1.1 (r311:74480, Dec  8 2009, 22:48:08) 
  [GCC 3.3.3 (SuSE Linux)] on linux2
  Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
  &gt;&gt;&gt; import subprocess
  &gt;&gt;&gt; process=subprocess.Popen('echo &quot;This is a test\nHave a loook see\n&quot; | mailx -s &quot;Test Python&quot; mymail@mycomopany.com')
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/depot/Python-3.1.1/lib/python3.1/subprocess.py&quot;, line 646, in __init__
      errread, errwrite)
    File &quot;/depot/Python-3.1.1/lib/python3.1/subprocess.py&quot;, line 1146, in _execute_child
      raise child_exception
  </code></pre>
  <p>I am a newbie to Python (now migrating from Perl). Any thoughts?</p>