我已使用以下代码发送一封电子邮件,正如其中一篇关于类似主题的帖子所建议的那样。但是邮件还没有发出。有什么建议么?
import subprocess
recipient = 'xxxxx@gmail.com'
subject = 'test'
body = 'testing mail through python'
def send_message(recipient, subject, body):
process = subprocess.Popen(['mail', '-s', subject, recipient],
stdin=subprocess.PIPE)
process.communicate(body)
print("sent the email")