Created
February 3, 2011 10:29
-
-
Save saicologic/809319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shlex | |
from eventlet.green import subprocess | |
mail = {} | |
mail['from'] = '[email protected]' | |
mail['to'] = '[email protected]' | |
mail['subject'] = 'test mail' | |
mail['body'] = 'test' | |
command_line = 'echo "From: <%s>\nTo: <%s>\nSubject:%s\n%s"' % (mail['from'],mail['to'],mail['subject'],mail['body']) | |
args = shlex.split(command_line) | |
p1 = subprocess.Popen(args, | |
stdout=subprocess.PIPE, | |
stderr=subprocess.STDOUT) | |
command_line = '/usr/sbin/sendmail -t %s' % mail['to'] | |
args = shlex.split(command_line) | |
subprocess.Popen(args, stdin=p1.stdout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment