我无法在python中发送没有密码验证的邮件。它打印最后一条消息但邮件没有发送。下面是我正在使用的代码。任何人请帮助我因此而被卡住。提前致谢。
import smtplib
fromaddr = 'xyz@gmail.com'
toaddrs = ['abc@gmail.com']
msg = '''
From: {fromaddr}
To: {toaddr}
Subject: 'testing'
This is a test
.
'''
msg = msg.format(fromaddr =fromaddr, toaddr = toaddrs[0])
server = smtplib.SMTP("gmail-smtp-in.l.google.com:25")
server.starttls()
server.ehlo("example.com")
server.mail(fromaddr)
server.rcpt(toaddrs[0])
server.data(msg)
server.quit/close()
print("mail sent")