我正在尝试使用电子邮件 python 脚本,并且想知道在编写基于 python 的电子邮件脚本时,与登录网页时通过 Internet 发送凭据相比,它是否安全?在以下脚本中,用户和传递是否明文?
import smtplib
from email.mime.text import MIMEText
GMAIL_LOGIN = 'xxxxxx@gmail.com'
GMAIL_PASSWORD = 'amiexposed?'
def send_email(subject, message, from_addr=GMAIL_LOGIN, to_addr=GMAIL_LOGIN):
msg = MIMEText(message)
msg['Subject'] = 'Test message'
msg['From'] = from_addr
msg['To'] = to_addr
server = smtplib.SMTP('smtp.gmail.com',587)
server.ehlo()
server.starttls()
server.ehlo()
server.login(GMAIL_LOGIN,GMAIL_PASSWORD)
server.sendmail(from_addr, to_addr, msg.as_string())
server.close()
if __name__ == '__main__':
send_email('testing email script', 'This is a test message')