在 Python 中使用 Lotus Notes 发送电子邮件时无法创建 link

Can't create link when send email using Lotus Notes in Python

我很抱歉之前的语法错误,我在 Python 中使用 lotus notes 发送消息时,我嵌入消息中的 link 未生成为 link (不是可点击,并像纯文本一样生成)在 doc.Body 和 link 中使用 doc.HTMLBody.

不可见
sess=win32com.client.Dispatch("Notes.NotesSession")
db = sess.getdatabase('','')
db.openmail
agent=db.getAgent("DeleteOldDocs")
doc=db.createdocument
doc.SendTo = recipients
doc.Subject = subject
doc.Body = "Test link http://www.thislink.com"
doc.HTMLBody  = "<a href='http://www.thislink.com'>Link</a>"
doc.send(0)

如何在电子邮件中发送可点击的 link?

例如:

This email send by program, and as You can see the link is not clickable and must be copy first then paste to the browser. This is not convenient for the client

使用NotesMIMEEntity to create a HTML formatted mail.

您的示例将如下所示:

sess=win32com.client.Dispatch("Notes.NotesSession")
db = sess.getdatabase('','')
stream = sess.CreateStream 
sess.ConvertMIME = False
doc = db.CreateDocument 
doc.Form = "Memo" 
body = doc.CreateMIMEEntity() 
header = body.CreateHeader("Subject") 
header.SetHeaderVal(subject) 
header = body.CreateHeader("To") 
header.SetHeaderVal(recipients) 
stream.writetext("<html><body>") 
stream.writetext("Test link http://www.thislink.com <a href='http://www.thislink.com'>Link</a>") 
stream.writetext("</body></html>") 
body.SetContentFromText(stream, "text/HTML;charset=UTF-8", 1728) 
doc.Send(0) 
sess.ConvertMIME = True