WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Lotus Notes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Send Email From Lotus Notes


Question:

My company has switched everyone from Outlook/Exchange to Notes/Domino for our corp email. I had a script that would create a new email in Outlook, via OLE, with a certain format subject and a certain format message body, and attach an Excel spreadsheet.

Does anyone have any examples of how to do the same thing in Notes 6.5? I'm having a hard time locating any reference on what objects do what in Notes.

Answer:

Note: If your mail server supports SMTP you might consider using the Postie Extender functions to send an email with attachments.

Here is some code based on some VBS code I found at google:


Session = ObjectOpen("Notes.NotesSession")
db = Session.GetDatabase("", "")

If db.IsOpen == @False
	db.OpenMail
EndIf

doc = db.CreateDocument
doc.Form = "Memo"
doc.sendto = "Recipient"
doc.subject = "subject"
doc.Body = "BodyText"
doc.SaveMessageOnSend = 1
doc.Send (1)

ObjectClose(doc)
ObjectClose(db)
ObjectClose(Session)
exit
Referenced:
(Keyword search for'Notes.NotesSession' on google)
http://groups.google.com/groups?q=Notes.NotesSession+send&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=_zVL8.15638%24tz4.5272392%40twister.nyc.rr.com&rnum=7

See Also: http://www.visualbasicforum.com/t67545.html

User Reply:

Thanks this was the bread crumb trail I needed! Added a couple of lines that attach a file to the email.
fname = "C:\Test.xls"
Session = ObjectOpen("Notes.NotesSession")
db = Session.GetDatabase("", "")

If db.IsOpen == @False
db.OpenMail
EndIf

doc = db.CreateDocument
doc.Form = "Memo"
doc.sendto = "Steve Romine"
doc.subject = "Test Stuff"
doc.Body = "This is the BodyText"
doc.SaveMessageOnSend = 1

;attach the Excel file
attachsheet = doc.createrichtextitem(fname)
embedobj = attachsheet.embedobject(1454, "", fname, fname)

doc.Send (0)

ObjectClose(embedobj)
ObjectClose(attachsheet)
ObjectClose(doc)
ObjectClose(db)
ObjectClose(Session)
exit

Update:

Here is a link to the Lotus Notes object model documentation: http://www-128.ibm.com/developerworks/lotus/documentation/notes/

http://www.ibm.com/developerworks/lotus/library/ls-Using_OLE_in_Notes/


Article ID:   W16072
File Created: 2008:04:15:09:15:44
Last Updated: 2008:04:15:09:15:44