python发送notes邮件,Python:如何访问Lotus Notes 8.5收件箱以阅读电子邮件

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

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)

here is my .py file

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()

解决方案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").

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值