python os.system from input nor working
<pre><code>#!/usr/bin/env python
import os
import subprocess
mail=raw_input("")
os.system("mail" + mail + "&lt;&lt;&lt;test")
</code></pre>

<p>When I run this program I`ve got error :sh: 1: Syntax error: redirection unexpected.</p>

<p>The script must send mail using mailutilis</p>

<p>Don't use <code>os.system</code>. Replace it with <code>subprocess.Popen</code>:</p>

<pre><code>address = raw_input()
with open('test') as text:
    subprocess.Popen(["mail", address], stdin=text).wait()
</code></pre>

python os.system