Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending email through lotus notes 1

Status
Not open for further replies.

gmagerr

Technical User
Aug 11, 2001
323
US
Hi guys
Can someone show me how to send an email through lotus notes? Something i can put into a script. Thanks.
 
It should work like this:

Code:
'Create a connection to the Notes application
notesSession = Create oleobject
notesSession.ConnectTONewObject("Notes.Notessession")

'Attach to the database
'for the default database
notesDatabase = notesSession.GetDatabase("","")
'for another database
notesDatabase = notesSession.GetDatabase("<SERVER >"," <USERNAME >")

'open the mailbox
IF NOT notesDatabase.IsOpen THEN
       notesDatabase.OpenMail()
END IF

'Create the mail document
notesDocument = notesDatabase.CreateDocument
'set to memo format
notesDocument.Form = "Memo"
'Set the subject
notesDocument.Subject = "Hello"
'Set the body
notesRichTextItem = notesDocument.CreateRichTextItem("Body")
NotesRichTextItem.AppendText("Here comes the body of the mail")

'Add an attachment
NotesRichTextItem.EmbedObject*(1454, "", "<Attachment Path>", "")

'Address the mail
Recipient = "recp1.one@tt.com"

'In order to set this list as the "To" list, use the "SendTo" property:
NotesDocument.SendTo = Recipient
'CC
NotesDocument.CopyTo = Recipient
'BCC
NotesDocument.BlindCopyTo= Recipient

'Other document properties
'Reserved Field Name        Values               Comments 
'DeliveryPriority           L, N, H              Values correspond to: low, normal or high-priority. 
'DeliveryReport             N, B, C, T           Values correspond to: none, only on failure, confirm delivery, trace entire path 
'Encrypt                    1, 0                 Use 1 to encrypt mailed documents. 
'ReturnReceipt              1, 0                 Use 1 to send a receipt when the document is opened by the recipient. 
'Sign                       1, 0                 Use 1 to add an electronic signature to the fields. (Only applicable if a form 
'                                                also contains sign-enabled fields.) 
'SaveMessageOnSend          True, False          If true the document will be saved to the send item list. 
'PostedDate                 Today’s date time    Can be retrieved using the "NOW" function. 

NotesDocument.ReturnReceipt = ‘1’

'Save the document
NotesDocument.Save(TRUE, FALSE ,TRUE)
'Syntax   notesDocument.Save( force, createResponse [, markRead ] )

'Send the message
NotesDocument.Send(FALSE)

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Thanks for the info Mark, very helpful as usual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top