guneshs

SMTPLIB

May 27th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1.  
  2. import smtp
  3. message = 'shit'
  4. # setup the parameters of the message
  5.  
  6. HOST = 'dutypare-com.mail.protection.outlook.com'
  7. PORT = '587'
  8.  
  9. msg['From'] = sender
  10. msg['To'] = receivers
  11. msg['Subject'] = "Subscription"
  12.  
  13. # add in the message body
  14. msg.attach(MIMEText(message, 'plain'))
  15.  
  16. #create server
  17. server = smtplib.SMTP_SSL(HOST, PORT)
  18.  
  19. server.starttls()
  20.  
  21. # Login Credentials for sending the mail
  22. server.login(msg['From'], password)
  23.  
  24.  
  25. # send the message via the server.
  26. server.sendmail(msg['From'], msg['To'], msg.as_string())
  27.  
  28. server.quit()
  29.  
  30. print("successfully sent email to %s:" % (msg['To']))
Add Comment
Please, Sign In to add comment