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 Through Lotus Notes


Here is a link that shows the .VBS example i would like to translate to WinBatch http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=8815&lngWId=4

Here is a working example of sending Lotus Notes emails using Winbatch 2004F. This includes sending attachments, multiple addresses, and saving the email.

;Send Email through Lotus Notes 
;***********************************************************************************************************************
;	Send Lotus Notes Mail
;***********************************************************************************************************************
#DefineFunction SendLotusNotesMail(Attachment,DISTRIBUTION_LIST,Body,bSendAttachment,Subject)


Session = ObjectCreate("Notes.NotesSession")
db = Session.GetDatabase("", "")
If db.IsOpen == @False then db.OpenMail
doc = db.createDocument()

doc.appendItemValue("Form", "Memo");
doc.appendItemValue("Subject",Subject)
doc.appendItemValue("Body",Body)
doc.appendItemValue("SaveMessageOnSend",0)		;set to 1 if you want to save your message

	if bSendAttachment == 1 then
		if db.PercentUsed > 98.9 then
			rc = Message("Could Not Sent Attachments", StrCat("Your Lotus Notes Is Currently At ",db.PercentUsed,"%% Used"))
			doc.Body = StrCat('Could Not Attach Logs - Percentage Used =',db.PercentUsed,@CRLF,@CRLF,Body)
		else
			attachsheet = doc.createrichtextitem("Attachment")
			embedobj = attachsheet.embedobject(1454, "", Attachment, "Attachment")
		end if
	end if

	TotalDistribution = itemcount(DISTRIBUTION_LIST,',')
	for xloop = 1 to TotalDistribution
		SendTo = ItemExtract(xloop,DISTRIBUTION_LIST,',')
		doc.ReplaceItemValue("sendto",ItemExtract(xloop,DISTRIBUTION_LIST,','))
		doc.Send (0)
	next xloop
	
	if db.PercentUsed <= 98.9 && bSendAttachment == 1 then
		embedobj = ""
		attachsheet = ""
	end if
	doc = ""
	db = ""
	Session = ""

	rc = Message("Lotus Notes Has Been Sent", StrCat("Information Has Been Sent To ",DISTRIBUTION_LIST))

	return
	
#EndFunction
;***********************************************************************************************************************
DISTRIBUTION_LIST = "myemail@here.com,youremail@here.com"
bSendAttachment = 1
Attachment = "e:\temp\a.txt"
Subject = "Test Lotus Notes"
Body = "This is the body of the attachment"

SendLotusNotesMail(Attachment,DISTRIBUTION_LIST,Body,bSendAttachment,Subject)

Article ID:   W16655
File Created: 2005:02:18:12:21:46
Last Updated: 2005:02:18:12:21:46