msg = MIMEText('Here is the body of my message')
msg['From'] = 'me@example.com'
msg['To'] = 'you@example.com'
msg['Subject'] = 'This is the subject.'
p = Popen(['/usr/sbin/sendmail', '-t', '-oi'], stdin=PIPE)
p.communicate(msg.as_string())
Отправка почты через sendmail из python