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


Python Util.flattenMessage方法代码示例

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


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

示例1: store

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import flattenMessage [as 别名]
	def store(self):
		# delete old message
		self.imap.uid('store',self.uid,'+FLAGS','(\Deleted)')
		self.imap.expunge()
		# store message
		if self.seen:
			self.imap.append(self.mailbox,'(\Seen)','',Util.flattenMessage(self.mail))
		else:
			self.imap.append(self.mailbox,'(\\Seen)','',Util.flattenMessage(self.mail))
开发者ID:crmulliner,项目名称:arcane,代码行数:11,代码来源:imap.py

示例2: encrypt

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import flattenMessage [as 别名]
    def encrypt(self, uid):
        typ, data = self.M.uid('fetch', uid,'(RFC822)')
    
        if data == None:
            return

        mail = email.message_from_string(data[0][1])
        if mail.get_content_type() == 'multipart/encrypted':
            return

        # Parse the original date
        headerFields = email.parser.HeaderParser().parsestr(data[0][1])
        if headerFields == None: 
            date = ''
        else:
            pz = email.utils.parsedate_tz(headerFields['Date'])
            stamp = email.utils.mktime_tz(pz)
            date = imaplib2.Time2Internaldate(stamp)

        # Encrypt the message
        encrypted_mail = gpg.GPGEncryption().encryptPGP(mail, self.config['pubkey'])
    
        # Delete the plaintext message
        if 'trash' in self.config and self.config['trash'] != '':
            self.M.uid('copy', uid, self.config['trash'])
    
        self.M.uid('store', uid, '+FLAGS', '\\Deleted')
        self.M.expunge()
        
        # Append the encrypted message
        move_to = self.config['mailbox'] if 'move_to' not in self.config else self.config['move_to']
        read = '' if self.config['monitor'] == 'UNSEEN' else '\\seen'
        self.M.append(move_to, read, date, Util.flattenMessage(encrypted_mail))
开发者ID:mannkind,项目名称:imap_encrypt,代码行数:35,代码来源:IMAPEncrypt.py

示例3: _extractMIMEPayload

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import flattenMessage [as 别名]
	def _extractMIMEPayload(self,mail):
		# Email is non multipart
		if type(mail.get_payload()) == types.StringType:
			# duplicate content-type and charset
			mimemail = MIMEBase(mail.get_content_maintype(),mail.get_content_subtype(),charset=mail.get_content_charset())
			mimemail.set_payload(mail.get_payload())
			# copy transfer encoding
			if mail.has_key('Content-Transfer-Encoding'):
				del mimemail['Content-Transfer-Encoding']
				mimemail['Content-Transfer-Encoding'] = mail['Content-Transfer-Encoding']
		# for a multipart email just add every sub message
		else:
			mimemail = MIMEMultipart("mixed")
			for payload in mail.get_payload():
				mimemail.attach(payload)

		return Util.flattenMessage(mimemail)
开发者ID:n0g,项目名称:arcane,代码行数:19,代码来源:gpg.py


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