Reputation: 441
import subprocess
to ='[email protected]'
subject= 'hostname'
cmd= "cat /var/log | mailx -s 'swap is full on'+subject" +to
subprocess.Popen(cmd,shell=True)
Upvotes: 1
Views: 1231
Reputation: 1303
Can you try this:
import subprocess
to ='[email protected]'
cmd= "cat /var/log | mailx -s 'test' " + to
subprocess.Popen(cmd,shell=True)
Upvotes: 1