本文介绍了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()

推荐答案

查看 http://www-01.ibm.com/support/docview.wss?uid=swg21308538

我建议(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收件箱以阅读电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 11:39