当前位置: 首页>>代码示例>>Python>>正文


Python MIMEMultipart.__init__方法代码示例

本文整理汇总了Python中email.mime.multipart.MIMEMultipart.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python MIMEMultipart.__init__方法的具体用法?Python MIMEMultipart.__init__怎么用?Python MIMEMultipart.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在email.mime.multipart.MIMEMultipart的用法示例。


在下文中一共展示了MIMEMultipart.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from email.mime.multipart import MIMEMultipart [as 别名]
# 或者: from email.mime.multipart.MIMEMultipart import __init__ [as 别名]
def __init__(self, subject='', body='', from_email=None, to=None, bcc=None,
            connection=None, attachments=None, headers=None, alternatives=None,
            cc=None, reply_to=None):
        """
        Initialize a single email message (which can be sent to multiple
        recipients).

        All strings used to create the message can be unicode strings (or UTF-8
        bytestrings). The SafeMIMEText class will handle any necessary encoding
        conversions.
        """
        super(EmailMultiAlternatives, self).__init__(
            subject, body, from_email, to, bcc, connection, attachments,
            headers, cc, reply_to,
        )
        self.alternatives = alternatives or [] 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:18,代码来源:message.py

示例2: __init__

# 需要导入模块: from email.mime.multipart import MIMEMultipart [as 别名]
# 或者: from email.mime.multipart.MIMEMultipart import __init__ [as 别名]
def __init__(self, _text, _subtype='plain', _charset=None):
        self.encoding = _charset
        if _charset == 'utf-8':
            # Unfortunately, Python < 3.5 doesn't support setting a Charset instance
            # as MIMEText init parameter (http://bugs.python.org/issue16324).
            # We do it manually and trigger re-encoding of the payload.
            MIMEText.__init__(self, _text, _subtype, None)
            del self['Content-Transfer-Encoding']
            has_long_lines = any(len(l) > RFC5322_EMAIL_LINE_LENGTH_LIMIT for l in _text.splitlines())
            # Quoted-Printable encoding has the side effect of shortening long
            # lines, if any (#22561).
            self.set_payload(_text, utf8_charset_qp if has_long_lines else utf8_charset)
            self.replace_header('Content-Type', 'text/%s; charset="%s"' % (_subtype, _charset))
        elif _charset is None:
            # the default value of '_charset' is 'us-ascii' on Python 2
            MIMEText.__init__(self, _text, _subtype)
        else:
            MIMEText.__init__(self, _text, _subtype, _charset) 
开发者ID:KimJangHyeon,项目名称:NarshaTech,代码行数:20,代码来源:message.py

示例3: __init__

# 需要导入模块: from email.mime.multipart import MIMEMultipart [as 别名]
# 或者: from email.mime.multipart.MIMEMultipart import __init__ [as 别名]
def __init__(self, subject='', body='', from_email=None, to=None, bcc=None,
                 connection=None, attachments=None, headers=None, alternatives=None,
                 cc=None, reply_to=None):
        """
        Initialize a single email message (which can be sent to multiple
        recipients).

        All strings used to create the message can be unicode strings (or UTF-8
        bytestrings). The SafeMIMEText class will handle any necessary encoding
        conversions.
        """
        super(EmailMultiAlternatives, self).__init__(
            subject, body, from_email, to, bcc, connection, attachments,
            headers, cc, reply_to,
        )
        self.alternatives = alternatives or [] 
开发者ID:prakharchoudhary,项目名称:Scrum,代码行数:18,代码来源:message.py

示例4: __init__

# 需要导入模块: from email.mime.multipart import MIMEMultipart [as 别名]
# 或者: from email.mime.multipart.MIMEMultipart import __init__ [as 别名]
def __init__(self, protocol, micalg, boundary=None, _subparts=None):
        """
        Initialize the multipart/signed message.

        :param boundary: the multipart boundary string. By default it is
            calculated as needed.
        :type boundary: str
        :param _subparts: a sequence of initial subparts for the payload. It
            must be an iterable object, such as a list. You can always
            attach new subparts to the message by using the attach() method.
        :type _subparts: iterable
        """
        MIMEMultipart.__init__(
            self, _subtype='signed', boundary=boundary,
            _subparts=_subparts)
        self.set_param('protocol', protocol)
        self.set_param('micalg', micalg) 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:19,代码来源:rfc3156.py

示例5: __init__

# 需要导入模块: from email.mime.multipart import MIMEMultipart [as 别名]
# 或者: from email.mime.multipart.MIMEMultipart import __init__ [as 别名]
def __init__(self, _text, _subtype='plain', _charset=None):
        self.encoding = _charset
        if _charset == 'utf-8':
            # Unfortunately, Python < 3.5 doesn't support setting a Charset instance
            # as MIMEText init parameter (http://bugs.python.org/issue16324).
            # We do it manually and trigger re-encoding of the payload.
            MIMEText.__init__(self, _text, _subtype, None)
            del self['Content-Transfer-Encoding']
            # Workaround for versions without http://bugs.python.org/issue19063
            if (3, 2) < sys.version_info < (3, 3, 4):
                payload = _text.encode(utf8_charset.output_charset)
                self._payload = payload.decode('ascii', 'surrogateescape')
                self.set_charset(utf8_charset)
            else:
                self.set_payload(_text, utf8_charset)
            self.replace_header('Content-Type', 'text/%s; charset="%s"' % (_subtype, _charset))
        elif _charset is None:
            # the default value of '_charset' is 'us-ascii' on Python 2
            MIMEText.__init__(self, _text, _subtype)
        else:
            MIMEText.__init__(self, _text, _subtype, _charset) 
开发者ID:0daybug,项目名称:DjangoBlog,代码行数:23,代码来源:message.py

示例6: __init__

# 需要导入模块: from email.mime.multipart import MIMEMultipart [as 别名]
# 或者: from email.mime.multipart.MIMEMultipart import __init__ [as 别名]
def __init__(self, _text, _subtype='plain', _charset=None):
        self.encoding = _charset
        if _charset == 'utf-8':
            # Unfortunately, Python doesn't yet pass a Charset instance as
            # MIMEText init parameter to set_payload().
            # http://bugs.python.org/issue27445
            # We do it manually and trigger re-encoding of the payload.
            if six.PY3 and isinstance(_text, bytes):
                # Sniffing encoding would fail with bytes content in MIMEText.__init__.
                _text = _text.decode('utf-8')
            MIMEText.__init__(self, _text, _subtype, None)
            del self['Content-Transfer-Encoding']
            has_long_lines = any(len(l) > RFC5322_EMAIL_LINE_LENGTH_LIMIT for l in _text.splitlines())
            # Quoted-Printable encoding has the side effect of shortening long
            # lines, if any (#22561).
            self.set_payload(_text, utf8_charset_qp if has_long_lines else utf8_charset)
            self.replace_header('Content-Type', 'text/%s; charset="%s"' % (_subtype, _charset))
        elif _charset is None:
            # the default value of '_charset' is 'us-ascii' on Python 2
            MIMEText.__init__(self, _text, _subtype)
        else:
            MIMEText.__init__(self, _text, _subtype, _charset) 
开发者ID:MTG,项目名称:lifesoundtrack,代码行数:24,代码来源:message.py

示例7: __init__

# 需要导入模块: from email.mime.multipart import MIMEMultipart [as 别名]
# 或者: from email.mime.multipart.MIMEMultipart import __init__ [as 别名]
def __init__(self, subject='', body='', from_email=None, to=None, bcc=None,
                 connection=None, attachments=None, headers=None, alternatives=None,
                 cc=None, reply_to=None):
        """
        Initialize a single email message (which can be sent to multiple
        recipients).

        All strings used to create the message can be unicode strings (or UTF-8
        bytestrings). The SafeMIMEText class will handle any necessary encoding
        conversions.
        """

        to = self.clean_list(to)

        super(EmailMultiAlternatives, self).__init__(
            subject, body, from_email, to, bcc, connection, attachments,
            headers, cc, reply_to,
        )
        self.alternatives = alternatives or [] 
开发者ID:CMSgov,项目名称:bluebutton-web-server,代码行数:21,代码来源:message.py


注:本文中的email.mime.multipart.MIMEMultipart.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。