当前位置: 首页>>代码示例>>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;未经允许,请勿转载。