मैं अपने आप से एक सरल sendmail समारोह लिख रहा हूँ और मैं इस त्रुटि प्राप्त हो रही:नई पायथन के लिए, जीमेल एसएमटीपी त्रुटि
NameError: नाम 'SMTPException' परिभाषित नहीं है
क्या मेरी कोड के साथ गलत क्या है? कोई सुझाव?
import smtplib
sender = "[email protected]"
receiver = ["[email protected]"]
message = "Hello!"
try:
session = smptlib.SMTP('smtp.gmail.com',587)
session.ehlo()
session.starttls()
session.ehlo()
session.login(sender,'password')
session.sendmail(sender,receiver,message)
session.quit()
except SMTPException:
print('Error')
आह मुझे एक वर्तनी त्रुटि थी। – eatonphil
चिंता न करें, एसएमटीपी के साथ काम करने के 20 साल बाद भी, मैं अभी भी ऐसा करता हूं। –