Advertisement
DigitalMag

smtp ssl python

Oct 8th, 2020
4,535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. import smtplib
  2.  
  3. EMAIL_HOST = 'smtp.beget.com'
  4.  
  5.  
  6. EMAIL_HOST_USER = EMAIL # EMAIL.split('@')[0]
  7. EMAIL_HOST_PASSWORD = 'Admin111'
  8.  
  9. SUBJECT = "Test email from Python"
  10. BODY = "\r\n".join((
  11.     "From: %s" % EMAIL,
  12.     "To: %s" % '',
  13.     "Subject: %s" % SUBJECT ,
  14.     "",
  15.     'none'
  16. ))
  17.  
  18. # server.starttls()
  19. server = smtplib.SMTP_SSL(EMAIL_HOST, 465)  # 25 port
  20.  
  21. r = server.login(EMAIL_HOST_USER, EMAIL_HOST_PASSWORD)
  22. server.sendmail(EMAIL, ['[email protected]', '[email protected]'], BODY)
  23. server.quit()
  24.  
  25. print('ok')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement