def __init__(self, type_, **params): self.mimetype = type_ # classes from email.* are all old-style :( Message.__init__(self) self.add_header('Content-Type', type_, **params)
def __init__(self, name, text): Message.__init__(self) self.add_header('Content-Disposition', 'form-data', name=name, charset="utf-8") self.set_payload(text, None)
def __init__(self): Message.__init__(self) """ If I don't set transfer-encoding myself, set_charset() will set it to base64 which apparently is wrong """ self.add_header('Content-Transfer-Encoding', '8bit') self.set_charset("utf-8")
def __init__(self): Message.__init__(self) """ If I don't set transfer-encoding myself, set_charset() will set it to base64 which apparently is wrong """ self.add_header("Content-Transfer-Encoding", "8bit") self.set_charset("utf-8")
def __init__(self, type_, **params): self.mimetype = type_ # classes from email.* are all old-style in Python, so don't replace # this with super() Message.__init__(self) self.add_header('Content-Type', type_, **params)
def __init__(self): Message.__init__(self) self._body_plain = None self._body_plain_payload = None self._body_html = None self._body_html_payload = None self._attachments = None self._attachments_payload = None
def __init__(self,fp=None,seekable=1): Message.__init__(self) self.submsg = None self.modified = False ## @var headerchange # Provide a headerchange event for integration with Milter. # The headerchange attribute can be assigned a function to be called when # changing headers. The signature is: # headerchange(msg,name,value) -> None self.headerchange = None
def __init__(self, *args, **kwargs): Message.__init__(self, *args, **kwargs) self._addresses_parsed = False self._sender_parsed = False self.original_sender = '' self.recipient_emails = set() self.commands = set() # This will be a set of curried functions self.skip_addresses = set() # These addresses will already be receiving the email and shouldn't get a copy. self.mailing_lists = set() # This will be a set of MailingLists that are targeted to receive an email self.missing_addresses = set() # This is a set of email addresses at the current domain which can't be matched to lists
def __init__(self): """ sel.data - list of dictionaries: { 'title' : 'XXX', 'authors' : 'XXX', 'abstract' : 'XXX', 'url' : 'http://XXX', 'comments' : 'XXX', 'categories' : 'XXX', 'class' : 'XXX' , 'arxiv_nr' : '1206.3197', 'date' : of the type: datetime.datetime.now() } """ Message.__init__(self) self.message = [] # will be filled by self.parse() method using: email_iterator(self) self.__len = 0 self.data = [] # will be filled by self.parse() method with arxiv content data. self.ind = 0
def __init__(self): Message.__init__(self) self.add_header('Content-Type', 'multipart/form-data') self._payload = []
def __init__(self,name,text): Message.__init__(self) self.add_header('Content-Disposition','form-data',name=name,charset="utf-8") self.set_payload(text,None)
def __init__(self): Message.__init__(self)
def __init__(self, _type, mimetype, data=None, file_name=None): """ Constructor __init__(Part) :param url: URL to be called :param timeout: Connection timeout in seconds :param event_handler: EventHandler to use :since: v0.1.0 """ # global: _PY_BYTES, _PY_BYTES_TYPE, _PY_STR, _PY_UNICODE_TYPE Message.__init__(self) self._content_id = None """ Defines what type the given data represents. """ self._part_type = _type """ Defines what type the given data represents. """ self.set_type(mimetype) if (self._part_type != Part.TYPE_MULTIPART and data is None): raise TypeError("Given data type is not supported") payload = None if (self._part_type == Part.TYPE_BINARY_ATTACHMENT or self._part_type == Part.TYPE_BINARY_INLINE): if (str is not _PY_BYTES_TYPE and type(data) is str): data = _PY_BYTES(data, "raw_unicode_escape") if (type(data) != _PY_BYTES_TYPE): raise TypeError("Given data type is not supported") self.add_header("Content-Transfer-Encoding", "base64") payload = b64encode(data) elif (self._part_type == Part.TYPE_ATTACHMENT or self._part_type == Part.TYPE_INLINE or self._part_type == Part.TYPE_MESSAGE_BODY): if (str is not _PY_BYTES_TYPE and type(data) is str): data = _PY_BYTES(data, "utf-8") if (type(data) is not _PY_BYTES_TYPE): raise TypeError("Given data type is not supported") self.add_header("Content-Transfer-Encoding", "quoted-printable") self.set_param("charset", "UTF-8", "Content-Type") payload = encodestring(data) # if (payload is not None): if (type(payload) is not str): payload = _PY_STR(payload, "raw_unicode_escape") self.set_payload(payload) # if (self._part_type == Part.TYPE_ATTACHMENT or self._part_type == Part.TYPE_BINARY_ATTACHMENT or self._part_type == Part.TYPE_BINARY_INLINE or self._part_type == Part.TYPE_INLINE): if (str != _PY_UNICODE_TYPE and type(file_name) is _PY_UNICODE_TYPE): file_name = _PY_STR(file_name, "utf-8") if (type(file_name) is not str): raise TypeError("Given file name type is not supported") self._content_id = "cid{0:d}@mail".format(id(self)) self.add_header("Content-ID", "<{0}>".format(self._content_id)) disposition_type = ("attachment" if (self._part_type == Part.TYPE_ATTACHMENT or self._part_type == Part.TYPE_BINARY_ATTACHMENT) else "inline") self.add_header("Content-Disposition", disposition_type, filename=file_name)
def __init__(self): Message.__init__(self) self._linesep = None
def __init__(self, *args, **kwargs): Message.__init__(self, *args, **kwargs)
def __init__(self, _type, mimetype, data = None, file_name = None): """ Constructor __init__(Part) :param url: URL to be called :param timeout: Connection timeout in seconds :param event_handler: EventHandler to use :since: v0.1.0 """ # global: _PY_BYTES, _PY_BYTES_TYPE, _PY_STR, _PY_UNICODE_TYPE Message.__init__(self) self._content_id = None """ Defines what type the given data represents. """ self._part_type = _type """ Defines what type the given data represents. """ self.set_type(mimetype) if (self._part_type != Part.TYPE_MULTIPART and data is None): raise TypeError("Given data type is not supported") payload = None if (self._part_type == Part.TYPE_BINARY_ATTACHMENT or self._part_type == Part.TYPE_BINARY_INLINE): if (str is not _PY_BYTES_TYPE and type(data) is str): data = _PY_BYTES(data, "raw_unicode_escape") if (type(data) != _PY_BYTES_TYPE): raise TypeError("Given data type is not supported") self.add_header("Content-Transfer-Encoding", "base64") payload = b64encode(data) elif (self._part_type == Part.TYPE_ATTACHMENT or self._part_type == Part.TYPE_INLINE or self._part_type == Part.TYPE_MESSAGE_BODY ): if (str is not _PY_BYTES_TYPE and type(data) is str): data = _PY_BYTES(data, "utf-8") if (type(data) is not _PY_BYTES_TYPE): raise TypeError("Given data type is not supported") self.add_header("Content-Transfer-Encoding", "quoted-printable") self.set_param("charset", "UTF-8", "Content-Type") payload = encodestring(data) # if (payload is not None): if (type(payload) is not str): payload = _PY_STR(payload, "raw_unicode_escape") self.set_payload(payload) # if (self._part_type == Part.TYPE_ATTACHMENT or self._part_type == Part.TYPE_BINARY_ATTACHMENT or self._part_type == Part.TYPE_BINARY_INLINE or self._part_type == Part.TYPE_INLINE ): if (str != _PY_UNICODE_TYPE and type(file_name) is _PY_UNICODE_TYPE): file_name = _PY_STR(file_name, "utf-8") if (type(file_name) is not str): raise TypeError("Given file name type is not supported") self._content_id = "cid{0:d}@mail".format(id(self)) self.add_header("Content-ID", "<{0}>".format(self._content_id)) disposition_type = ("attachment" if (self._part_type == Part.TYPE_ATTACHMENT or self._part_type == Part.TYPE_BINARY_ATTACHMENT) else "inline" ) self.add_header("Content-Disposition", disposition_type, filename = file_name)
def __init__(self, text, charset=None, blank_line_after_header=False): Message.__init__(self) self.set_payload(text) self._blank_line_after_header = blank_line_after_header
def __call__(self): if self.ok: return BaseMessage() BaseMessage.__init__(self) self.ok = True return self