Advertisement
DigitalMag

smtp ssl python

Oct 8th, 2020
4,422
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 = 'assistant@astro-practic.ru'
  4. EMAIL_HOST = 'smtp.beget.com'
  5.  
  6.  
  7. EMAIL_HOST_USER = EMAIL # EMAIL.split('@')[0]
  8. EMAIL_HOST_PASSWORD = 'Admin111'
  9.  
  10. SUBJECT = "Test email from Python"
  11. BODY = "\r\n".join((
  12.     "From: %s" % EMAIL,
  13.     "To: %s" % '',
  14.     "Subject: %s" % SUBJECT ,
  15.     "",
  16.     'none'
  17. ))
  18.  
  19. # server.starttls()
  20. server = smtplib.SMTP_SSL(EMAIL_HOST, 465)  # 25 port
  21.  
  22. r = server.login(EMAIL_HOST_USER, EMAIL_HOST_PASSWORD)
  23. server.sendmail(EMAIL, ['digital-mag@ya.ru', 'lebedeva.olga.alex@yandex.ru'], BODY)
  24. server.quit()
  25.  
  26. print('ok')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement