mailtoplone的基本软件包
mailtoplone.base的Python项目详细描述
mailtoplone.base
概述
mailtoplone的基本软件包
依赖性
附加蛋依赖性
伊卡伦达
python dateutil
内容
内容类型
收件箱:
Provides an XMLRPCView to access it’s drop method. Dropping a mailstring ( a plaintext string containing the whole email including envelope), a plone content type Email will be generated, the data field will contain the mailstring.
电子邮件:
File like content type conatining the mailstring inside the data field. View registered for IEmail: emailview ( as standard view ) shows:
- headers Subject, From, To, Cc
- body (prefers text/html parts over text/plain parts)
- attachments (download link)
适配器
邮箱:
Basic adapter, providing a drop method generating an Email out of the dropped mailstring
博客邮箱:
Advanced adapter, creating a news item out of the dropped mailstring.
事件邮箱:
Advanced adapter, creating an event out of text/calendar attachments inside the dropped mailstring
实用程序
BaseDropbox工厂:
Used to find objects providing IMailDropBoxMarker with id=key. Used by the deliver action in mailtoplone.contentrules.
iCalEventFactory:
Taking an icalendar string, this utility creates an ATEvent out of each VEVENT. The implementation supports keywordarguments, passing them to invokeFactory. This implementation correctly imports events exported from plone, as a first approach. It is used by the EventMailDropBox.
标记面
您可以使用这些markerinterfaces(@manage_interfaces)标记文件夹 对于mailtoplone(记住重新索引标记的对象)。之后 可以找到文件夹并将邮件发送到。
- imaildropboxmarker(接口):
- “邮件投递框的标记界面”
- IBlogMailDropboxMarker(imailDropboxMarker):
- “博客邮件投递框的标记界面”
- ieventmaildropboxmarker(imaildropboxmarker):
- “事件邮件投递框的标记界面”
脚本
Dropemail:
File system python script, to drop a mail to an inbox(url), specify the mail as file or use stdin
vim:设置ft=rst tw=75 nocin nosi ai sw=4 ts=4 expandtab:
更改历史记录
更改日志
0.2.7(2009-07-22)
- use subject to generate id for type Email, so we avoid being limited to 1000 emails per dropbox (fixes #7) [hplocher]
0.2.6(2008-12-02)
- fix dependency in setup.py to now require python-dateutil (was dateutil earlier)
- correct propertiestool.xml to not purge, and only add Email to typesUseViewActionInListings [hplocher]
- for earlier changes see included CHANGELOG
详细文档
mailtoplone.base
设置测试环境
设置包含email1、email2的收件箱:
>>> self.setRoles(('Manager',)) >>> self.portal.invokeFactory('InBox', 'inbox') 'inbox' >>> self.portal.inbox.invokeFactory('Email', 'email1') 'email1' >>> self.portal.inbox.invokeFactory('Email', 'email3') 'email3'
适配器
让我们测试一下maildropbox适配器的drop函数, 丢失的邮件使用名称选择器获取其ID:
>>> from mailtoplone.base.interfaces import IMailDropBox >>> IMailDropBox(self.portal.inbox).drop("some data") >>> IMailDropBox(self.portal.inbox).drop("some data") >>> IMailDropBox(self.portal.inbox).drop("some data") >>> self.portal.inbox.objectIds() ['email1', 'email3', 'email', 'email-1', 'email-2']
让我们测试创建的电子邮件的一些值:
>>> self.portal.inbox.email.title 'email' >>> self.portal.inbox.email.data 'some data' >>> self.portal.inbox.email.meta_type 'Email'
浏览器视图xmlrpcview
让我们测试一下xmlrpcview是否有一个drop方法在 收件箱:
>>> theview = self.portal.inbox.restrictedTraverse('xmlrpcview') >>> theview.drop("dropped via view") >>> self.portal.inbox.objectIds() ['email1', 'email3', 'email', 'email-1', 'email-2', 'email-3'] >>> self.portal.inbox.listFolderContents()[5].data 'dropped via view'
电子邮件标题
我们为主题之外的电子邮件对象生成平铺,否则我们将 带上身份证。
首先,让我们创建各种极简主义电子邮件:
>>> withsubject = 'subject: withsubject' >>> withSubject = 'Subject: withSubject' >>> withbetreff = 'betreff: withbetreff' >>> withBetreff = 'Betreff: withBetreff'
让我们把这些电子邮件放到收件箱:
>>> theview.drop(withsubject) >>> self.portal.inbox.listFolderContents()[6].Title() 'withsubject' >>> theview.drop(withSubject) >>> self.portal.inbox.listFolderContents()[7].Title() 'withSubject' >>> theview.drop(withbetreff) >>> self.portal.inbox.listFolderContents()[8].Title() 'withbetreff' >>> theview.drop(withBetreff) >>> self.portal.inbox.listFolderContents()[9].Title() 'withBetreff'
如果我们的邮件中有多个主题/主题/…让我们把 第一个主题:
>>> theview.drop('Subject: SUB\nBetreff: BET') >>> self.portal.inbox.listFolderContents()[10].Title() 'SUB'
我们解码主题标题进行演示,让我们删除一个编码的主题:
>>> theview.drop('Subject: =?ISO-8859-15?Q?=FCld=F6m?=') >>> self.portal.inbox.listFolderContents()[11].Title() == 'üldöm' True
vim: set ft=rst tw=75 nocin nosi ai sw=4 ts=4 expandtab:
贡献者
汉斯·彼得·洛希尔,Inquant股份有限公司
Stefan Eletzhofer,Inquant股份有限公司