【发布时间】:2019-06-08 15:23:18
【问题描述】:
我是 php 程序员,使用 php 您可以直接向服务器发送电子邮件,例如此代码向客户端发送电子邮件:
<?php
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
但在 python 中,您必须使用 smtplib 和 gmail 或 hotmail 服务器来发送电子邮件。 我想知道有没有直接从服务器用python发送电子邮件?
【问题讨论】:
标签: python python-3.x email smtp