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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending email using macros - Lotusnotes

Status
Not open for further replies.
Sep 29, 2003
19
CA
I have tried the following code to send email using lotus notes application.Its working fine, but it is asking to enter the email pwd before sending the mail.Is it possible to avoid asking for the pwd.

Thanks
Coglearner

'--------------The Code Starts here------------------

Declare Sub LotusNotes(strSubject$, strTo$, strBody$)

Sub Main ()

Dim strToday As String
Dim strTo1 As String
Dim strAttachment As String
Dim strBody As String
Dim strSubject As String

Dim strRecipients AS String


'*** RECIPIENTS IS USED TO ADDRESS THE EMAIL TO ONE OR MORE INDIVIDUALS - BE SURE TO USE A SEMI-COLON ( ; ) BETWEEN NAMES




'*** THIS SECTION ASSIGNS THE CATALOG AND REPORT PATH NAMES.

strTo = "someone@somewhere.com"

strSubject = "Cube Generation Failed"
strBody = "Cube Generation Failed"
call LotusNotes(strSubject, strTo, strBody)
End Sub

Sub LotusNotes(strSubject$, strTo$, strBody$)

dim IndSession As Object
dim IngDirectory As Object
Dim IndDatabase As Object
Dim IndDocument As Object
Dim IndRTItem As Object

set IndSession = CreateObject("Lotus.NotesSession")

IndSession.Initialize
Set IngDirectory = IndSession.GetDbDirectory("")
Set IndDatabase = IngDirectory.OpenMailDatabase
Set IndDocument = IndDatabase.CreateDocument

'--Set Message Headers

Call IndDocument.AppendItemValue("Subject", strSubject$)
Call IndDocument.ReplaceItemValue("SendTo", strTo$)

'---Set Delivery Options

IndDocument.EncryptOnSend = True
IndDocument.SaveMessageOnSend = True
Call IndDocument.ReplaceItemValue("ReturnReceipt",True)

'---Add Content

Set IndRTItem = IndDocument.CreateRichTextItem("Body")
IndRTItem.AppendText(strBody$)
Set IndRTItem = Nothing

'---Send Message

call IndDocument.Send( FALSE )

End Sub
 
I have exactly the same problem - I will try the BI Toolbox website and get back to you if I find an answer
 
Hi,

Try this!

After you create the notes Session, pass the password.

set IndSession = CreateObject("Lotus.NotesSession")
IndSession.Initialize("password")


I know, this is not the perfect solution,
but if anyone does know better how to do this I would be interested in the solution.


ornel
 
This worked for me:

Dim objNotes as Object
Dim objNotesmail as Object
Dim PDFPub as Object
Dim objNotesSession as Object
Dim objNotesDB as Object
Dim objDoc as Object
Dim objRichText as Object

Set objNotesSession = CreateObject("Notes.NotesSession") 'Open Notes
strMailServer = &quot;<SERVERNAME>&quot;
strMailFile = &quot;<MAILFILE>.nsf&quot;


Set objNotesDB = objNotesSession.GetDatabase(strMailServer,strMailFile)
Set objDoc = objNotesDB.CreateDocument() 'Create new mail document
strNotesBody = &quot;<MESSAGE TEXT>&quot; 'Message text
strNotesSubject = &quot;<SUBJECT TEXT>&quot; 'Subject text

objDoc.subject = strNotesSubject
objDoc.body = strNotesBody
Set objRichText = objDoc.CreateRichTextItem(&quot;NewBody&quot;)

objDoc.SendTo = &quot;<MAIL ADDRESS>&quot; 'Send to
Call objDoc.Send(False)

Set objNotesSession = Nothing
Set objNotesDB = Nothing
Set objDoc = Nothing
Set objRichText = Nothing
Set objAttach = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top