from smtplib import SMTPfrom poplib import POP3from time import sleepSMTPSVR = 'smtp.python.is.cool'POP3SVR = 'pop.python.is.cool'origHdrs = ['From: from@python.com', 'To: to@python.com', 'Subject: test msg']origBody = ['xxx', 'yyy', 'zzz']origMsg = 'rnrn'.join(['rn'.join(origHdrs),'rn'.join(origBody)])sendSvr = SMTP(SMTPSVR)errs = sendSvr.sendmail('from@python.com',('to@python.com',), origMsg)sendSvr.quit()assert len(errs) == 0, errssleep(10)recvSvr = POP3(POP3SVR)recvSvr.user('wesley')recvSvr.pass_('youllNeverGuess')rsp, msg, siz = recvSvr.retr(recvSvr.stat()[0])sep = msg.index('')recvBody = msg[sep+1:]assert origBody == recvBody
Name (required)
email (will not be published) (required)
Website