在我的Python代码中,我遇到一个错误,提示“ smtplib.SMTPReciepientsRefused”。我已经检查了两次,但无法找出孔。谁能帮我填补这些空缺?
from email.mime.text import MIMEText
import smtplib
def send_email(email,X,Y,X1,Y1,location,holder_name):
from_email="abc@gmail.com"
from_password="abc123"
to_email=email
subject="DNA Record"
message="Your Data Has Been Recorded successfully"
msg=MIMEText(message,'html')
msg['Subject']=subject
msg['To']=to_email
msg['From']=from_email
gmail=smtplib.SMTP('smtp.gmail.com',587)
gmail.ehlo()
gmail.starttls()
gmail.login(from_email,from_password)
gmail.send_message(msg)