Advertisement
harsh7i

SendAolMail.py

Jun 20th, 2022 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. import smtplib
  2. import random
  3. from email.mime.multipart import MIMEMultipart
  4. from email.mime.text import MIMEText
  5.  
  6. # Connecting To Server
  7. server=smtplib.SMTP_SSL('smtp.aol.com',465)
  8.  
  9. # Variables
  10. email='harsh7i@aol.com'
  11. password='udnjulhngetulijt'
  12. to_email=input('Enter a Valid Email: ')
  13. to_email=str(to_email)
  14. verify_code=random.randint(12345,98765)
  15. verify_code=str(verify_code)
  16. message="This is Your Verification Code to Confirm email."
  17.  
  18. # Message
  19. msg=MIMEMultipart()
  20. msg['Subject']="TODO: Your Verification Code is "+verify_code
  21. msg['From']=email
  22. msg['To']=to_email
  23. msg.attach(MIMEText(message,'plain'))
  24.  
  25.  
  26. # Login in Server
  27. server.login(email,password)
  28.  
  29. # Sending Mail
  30. server.sendmail(email,to_email,msg.as_string())
  31.  
  32. # Server Quit
  33. server.quit()
  34.  
  35. # Conclusion
  36. print("Your Message with Code "+verify_code+" has been successfully sent to "+to_email)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement