上周我试图从python发送一封电子邮件,我成功但是当我想进行一些更改以便进行网站注册时,我得到一个我不明白的错误。
以下是我成功发送电子邮件的代码。此代码没有错误
import smtplib
server=smtplib.SMTP("smtp.gmail.com",587)
server.starttls()
server.login("******@gmail.com","******")
try:
server.sendmail("****@gmail.com","****@gmail.com","trial mail")
print("succesfull")
except:
print("not succesfull")
server.quit()
正如我所说,我想做一些改变而且我写了这段代码
name=input("Enter your name:")
surname=input("Enter your surname:")
print("Hello",name,surname,"we need your personal informations to send you an e-mail")
birthdate=input("Your date of birth:")
country=input("Where do you live?:")
e_mail=str(input("Your e-mail address?:"))
import smtplib
server=smtplib.SMTP("smtp.gmail.com",587)
server.starttls()
server.login("*****@gmail.com","*****")
try:
server.sendmail("****@gmail.com",e_mail,"Registration mail.")
print("Thanks for entering",name,"we send an e-mail to",e_mail)
except:
print("Gönderilemedi")
server.quit()
" server.sendmail(" **** @ gmail.com",e_mail,"注册邮件。")"在这段代码中我写的电子邮件地址,我想发送电子邮件程序的工作,但当我写e_mail而不是帐户等待输入这个程序不起作用。我认为它是该代码中唯一的错误有人知道吗?请帮帮我