Python:如何访问Lotus Notes 8.5收件箱以阅读电子邮件 [英] Python : How can I access Lotus Notes 8.5 Inbox to read emails

查看:780
本文介绍了Python:如何访问Lotus Notes 8.5收件箱以阅读电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在python中创建一个脚本,以读取Lotus Notes 8.5中的邮件,然后为每封电子邮件创建jira中的问题,但是当我尝试从Lotus中读取邮件时,它会向我返回此错误:

I want to make an script in python that reads mails from Lotus Notes 8.5 and then create for each email an issue in jira but it returns me this error when I try to read the mails from Lotus:

Traceback (most recent call last):
File "from_Lotus_TO_Jira.py", line 46, in <module>
main()
File "from_Lotus_TO_Jira.py", line 39, in main
folder = notesDatabase.GetView('$Inbox')
File "C:\Python27\lib\site-packages\win32com\gen_py\29131520-2EED-1069-BF5D-00
DD011186B7x0x1x2.py", line 1849, in GetView
ret = self._oleobj_.InvokeTypes(1610743866, LCID, 1, (9, 0), ((8, 1),),pName

pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'NotesDatabase',
u'Database  server_name!!C:\\Users\\MYNAME\\AppData\\Local\\Lotus\\Notes\\Data\\ma
il202\\myname.nsf has not been opened yet', None, 0, -2147217441), None)

这是我的.py文件

import win32com.client
import pywintypes
import getpass

def main():
    # Get credentials
    mailServer = 'server_name' 
    mailPath = 'C:\Users\MYNAME\AppData\Local\Lotus\Notes\Data\mail202\myname.nsf'


    mailPassword = ''
    # Connect
    notesSession = win32com.client.Dispatch('Lotus.NotesSession')



    notesSession.Initialize(mailPassword)
    notesDatabase = notesSession.GetDatabase(mailServer, mailPath)

    # Get a list of folders
    folder = notesDatabase.GetView('$Inbox')
    document = folder.GetFirstDocument()



if __name__ == "__main__":
    main()

推荐答案

查看

完整的文件路径(例如"C:\ notes \ data \ r_apps \ haha​​.nsf") 在访问工作站上的本地数据库时可选使用.如果 您可以指定服务器名称,或者代码是否在服务器上运行 服务器,您必须使用相对于Notes数据目录的路径 ("r_apps \ haha​​.nsf").

The full filepath (e.g. "C:\notes\data\r_apps\haha.nsf") may optionally be used when accessing local databases on a workstation. If you specify a server name, however, or if the code is running on a server, you must use the path relative to the Notes data directory ("r_apps\haha.nsf").

我建议(a)不指定服务器,或者(b)仅提供相对路径,即mailPath = r'mail202\myname.nsf'.

I suggest either (a) not specifying a server or (b) only giving a relative path, ie mailPath = r'mail202\myname.nsf'.

这篇关于Python:如何访问Lotus Notes 8.5收件箱以阅读电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆