@@ -0,0 +1,2169 @@
+# Copyright (c) 2014 ASMlover. All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions%0A# are met:%0A#%0A#  * Redistributions of source code must retain the above copyright%0A#    notice, this list ofconditions and the following disclaimer.%0A#%0A#  * Redistributions in binary form must reproduce the above copyright%0A#    notice, this list of conditions and the following disclaimer in%0A#    the documentation and/or other materialsprovided with the%0A#    distribution.%0A#%0A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS%0A# %22AS IS%22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT%0A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS%0A# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE%0A# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,%0A# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,%0A# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;%0A# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER%0A# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT%0A# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN%0A# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE%0A# POSSIBILITY OF SUCH DAMAGE.%0A#%0A#!/usr/bin/env python%0A# -*- encoding: utf-8 -*-%0A%0Afrom smtplib import SMTP %0Afrom poplib import POP3%0Afrom time import sleep%0A%0A%0ASMTPSRV = 'smtp.163.com'%0APOP3SRV = 'pop.163.com'%0A%0A%0AoriginHeader = %5B%0A  'From: zfxfcx@163.com', 'To: zfxfcx@163.com', 'Subject: test msg' %5D%0AoriginBody = %5B'xxx', 'yyy', 'zzz'%5D%0AoriginMsg = %5C%0A  '%5Cr%5Cn%5Cr%5Cn'.join(%5B'%5Cr%5Cn'.join(originHeader), '%5Cr%5Cn'.join(originBody)%5D)%0A%0A%0Apasswd = raw_input('input passwd : ')%0A%0AsendSrv = SMTP(SMTPSRV)%0AsendSrv.login('zfxfcx@163.com', passwd)%0Aerrs = sendSrv.sendmail('zfxfcx@163.com', ('zfxfcx@163.com', ), originMsg)%0AsendSrv.quit()%0Aassert len(errs) == 0, errs%0Asleep(10)%0A%0A%0ArecvSrv = POP3(POP3SRV)%0ArecvSrv.user('zfxfcx')%0ArecvSrv.pass_(passwd)%0Arsp, msg, sz = recvSrv.retr(recvSrv.stat()%5B0%5D)%0Asep = msg.index('')%0ArecvBody = msg%5Bsep+1:%5D%0Aassert originBody == recvBody%0Aprint recvBody%0A

add demo about email