PYTHON   76
test pop
Guest on 10th February 2023 01:44:02 AM


  1. #!/usr/bin/python
  2.  
  3. import sys, poplib, smtplib
  4.  
  5. if __name__=="__main__":
  6.     print sys.argv
  7.     if len(sys.argv) <= 1:
  8.         print "usage: ", sys.argv[0], " mailhost"
  9.         sys.exit(1)
  10.  
  11.     # get the hostname
  12.     hostname = sys.argv[1]
  13.  
  14.     # get the username
  15.     username = raw_input("Username:")
  16.  
  17.     # geth the password
  18.     passwd = raw_input("Password:")
  19.  
  20.     # open a connection
  21.     print "Opening POP3 connection ...."
  22.     c = poplib.POP3(hostname)
  23.     c.user(username)
  24.     c.pass_(passwd)
  25.  
  26.     # close it again
  27.     c.quit()
  28.     print "POP3 connection worked !"

Raw Paste

Login or Register to edit or fork this paste. It's free.