當前位置: 首頁>>代碼示例>>Python>>正文


Python smtplib.quoteaddr方法代碼示例

本文整理匯總了Python中smtplib.quoteaddr方法的典型用法代碼示例。如果您正苦於以下問題:Python smtplib.quoteaddr方法的具體用法?Python smtplib.quoteaddr怎麽用?Python smtplib.quoteaddr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在smtplib的用法示例。


在下文中一共展示了smtplib.quoteaddr方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: smtp_VRFY

# 需要導入模塊: import smtplib [as 別名]
# 或者: from smtplib import quoteaddr [as 別名]
def smtp_VRFY(self, arg):
        # For max compatibility smtplib should be sending the raw address.
        if arg in sim_users:
            self.push('250 %s %s' % (sim_users[arg], smtplib.quoteaddr(arg)))
        else:
            self.push('550 No such user: %s' % arg) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:8,代碼來源:test_smtplib.py

示例2: smtp_EXPN

# 需要導入模塊: import smtplib [as 別名]
# 或者: from smtplib import quoteaddr [as 別名]
def smtp_EXPN(self, arg):
        list_name = arg.lower()
        if list_name in sim_lists:
            user_list = sim_lists[list_name]
            for n, user_email in enumerate(user_list):
                quoted_addr = smtplib.quoteaddr(user_email)
                if n < len(user_list) - 1:
                    self.push('250-%s %s' % (sim_users[user_email], quoted_addr))
                else:
                    self.push('250 %s %s' % (sim_users[user_email], quoted_addr))
        else:
            self.push('550 No access for you!') 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:14,代碼來源:test_smtplib.py

示例3: testVRFY

# 需要導入模塊: import smtplib [as 別名]
# 或者: from smtplib import quoteaddr [as 別名]
def testVRFY(self):
        smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)

        for email, name in sim_users.items():
            expected_known = (250, '%s %s' % (name, smtplib.quoteaddr(email)))
            self.assertEqual(smtp.vrfy(email), expected_known)

        u = 'nobody@nowhere.com'
        expected_unknown = (550, 'No such user: %s' % u)
        self.assertEqual(smtp.vrfy(u), expected_unknown)
        smtp.quit() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:13,代碼來源:test_smtplib.py

示例4: testEXPN

# 需要導入模塊: import smtplib [as 別名]
# 或者: from smtplib import quoteaddr [as 別名]
def testEXPN(self):
        smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)

        for listname, members in sim_lists.items():
            users = []
            for m in members:
                users.append('%s %s' % (sim_users[m], smtplib.quoteaddr(m)))
            expected_known = (250, '\n'.join(users))
            self.assertEqual(smtp.expn(listname), expected_known)

        u = 'PSU-Members-List'
        expected_unknown = (550, 'No access for you!')
        self.assertEqual(smtp.expn(u), expected_unknown)
        smtp.quit() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:16,代碼來源:test_smtplib.py

示例5: testVRFY

# 需要導入模塊: import smtplib [as 別名]
# 或者: from smtplib import quoteaddr [as 別名]
def testVRFY(self):
        smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)

        for addr_spec, name in sim_users.items():
            expected_known = (250, bytes('%s %s' %
                                         (name, smtplib.quoteaddr(addr_spec)),
                                         "ascii"))
            self.assertEqual(smtp.vrfy(addr_spec), expected_known)

        u = 'nobody@nowhere.com'
        expected_unknown = (550, ('No such user: %s' % u).encode('ascii'))
        self.assertEqual(smtp.vrfy(u), expected_unknown)
        smtp.quit() 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:15,代碼來源:test_smtplib.py

示例6: testEXPN

# 需要導入模塊: import smtplib [as 別名]
# 或者: from smtplib import quoteaddr [as 別名]
def testEXPN(self):
        smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)

        for listname, members in sim_lists.items():
            users = []
            for m in members:
                users.append('%s %s' % (sim_users[m], smtplib.quoteaddr(m)))
            expected_known = (250, bytes('\n'.join(users), "ascii"))
            self.assertEqual(smtp.expn(listname), expected_known)

        u = 'PSU-Members-List'
        expected_unknown = (550, b'No access for you!')
        self.assertEqual(smtp.expn(u), expected_unknown)
        smtp.quit() 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:16,代碼來源:test_smtplib.py

示例7: testVRFY

# 需要導入模塊: import smtplib [as 別名]
# 或者: from smtplib import quoteaddr [as 別名]
def testVRFY(self):
        smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)

        for email, name in sim_users.items():
            expected_known = (250, bytes('%s %s' %
                                         (name, smtplib.quoteaddr(email)),
                                         "ascii"))
            self.assertEqual(smtp.vrfy(email), expected_known)

        u = 'nobody@nowhere.com'
        expected_unknown = (550, ('No such user: %s' % u).encode('ascii'))
        self.assertEqual(smtp.vrfy(u), expected_unknown)
        smtp.quit() 
開發者ID:IronLanguages,項目名稱:ironpython3,代碼行數:15,代碼來源:test_smtplib.py

示例8: mail

# 需要導入模塊: import smtplib [as 別名]
# 或者: from smtplib import quoteaddr [as 別名]
def mail(self, sender, options=[]):
        optionlist = ''
        if options and self.does_esmtp:
            optionlist = ' ' + ' '.join(options)
        (code, msg) = yield self.docmd(b'mail', ('FROM:%s%s' % (smtplib.quoteaddr(sender), optionlist)).encode('ascii'))
        return (code, msg) 
開發者ID:vuamitom,項目名稱:tornado-smtpclient,代碼行數:8,代碼來源:client.py

示例9: rcpt

# 需要導入模塊: import smtplib [as 別名]
# 或者: from smtplib import quoteaddr [as 別名]
def rcpt(self, recip, options=[]):
        """SMTP 'rcpt' command -- indicates 1 recipient for this mail."""
        optionlist = ''
        if options and self.does_esmtp:
            optionlist = ' ' + ' '.join(options)
        code, msg = yield self.docmd(b"rcpt", ("TO:%s%s" % (smtplib.quoteaddr(recip), optionlist)).encode('ascii'))
        return (code, msg) 
開發者ID:vuamitom,項目名稱:tornado-smtpclient,代碼行數:9,代碼來源:client.py


注:本文中的smtplib.quoteaddr方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。