Lotus notes "Who" property? --Urgent

gdanalakshmi

Registered User.
Local time
Today, 20:14
Joined
Nov 26, 2002
Messages
102
I am able to send lotus notes email through VBA code.
But , my sent folder has a "Who" column which is blank.
It has the date and sub set correctly. When i open the mail in the sent folder, I can see the correct To list and everything.

I would like to set the Who field. What is the property to set it through VBA code??
 
Post your code and I will look at it.
 
Dim recip(25) As Variant

Set Session = CreateObject("Notes.NotesSession")
Set Maildb = Session.GETDATABASE("", MailDbName)
'Set UIDocument = UIWorkspace.EDITDOCUMENT(True)
If Maildb.ISOPEN = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
'recip is an array of recipients
MailDoc.SendTo = recip


MailDoc.Subject = SubjectText
MailDoc.Body = MessageBody & vbCrLf & vbCrLf
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.SAVEMESSAGEONSEND = True

MailDoc.Send 0, Recipient

'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachMe = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
 
Using your code (which was missing a lot of Dim's and the sub name) and some parts from a fucntion I found in cyberspace, the below works for me. You need to add back the "recip" so that you can send it to your list of users and change back the 'MailDoc' options I changed. To test sending the email, play the TestSendingEmail sub with your info.

Public Sub TestSendingEmail()
'Example to send an email...
BADSendNotesMail "ghudson", "Testing", "Testing 1 2 3", False, False, "C:\INSTALL.LOG"
End Sub

Public Sub BADSendNotesMail(cRecipient As String, cSubject As String, cBodyText As String, nSaveCopy As Boolean, nNotifySender As Boolean, Optional cAttach1 As String, Optional cAttach2 As String, Optional cAttach3 As String, Optional cAttach4 As String)

Dim Session As Object
Dim MailDBName As String
Dim MailDB As Object
Dim UserName As String
Dim MailDoc As Object
Dim File1 As Object
Dim Attachment1 As Object
Dim File2 As Object
Dim Attachment2 As Object
Dim File3 As Object
Dim Attachment3 As Object
Dim File4 As Object
Dim Attachment4 As Object
Dim recip

Set Session = CreateObject("Notes.NotesSession")

UserName = Session.UserName
MailDBName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"

Set MailDB = Session.GETDATABASE("", MailDBName)

'Set UIDocument = UIWorkspace.EDITDOCUMENT(True)
If MailDB.ISOPEN = True Then
'Already open for mail
Else
MailDB.OPENMAIL
End If

'Set up the new mail document
Set MailDoc = MailDB.CREATEDOCUMENT
MailDoc.Form = "Memo"
'recip is an array of recipients
MailDoc.SendTo = cRecipient 'recip
MailDoc.Subject = cSubject
MailDoc.Body = cBodyText & vbCrLf & vbCrLf
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.SAVEMESSAGEONSEND = True

'Clean Up
'Sets up the 1st embedded object and attachment and attach it
If cAttach1 <> "" Then
Set File1 = MailDoc.CREATERICHTEXTITEM("cAttach1")
Set Attachment1 = File1.EMBEDOBJECT(1454, "", cAttach1, "cAttach1")
End If
'Sets up the 2nd embedded object and attachment and attach it
If cAttach2 <> "" Then
Set File2 = MailDoc.CREATERICHTEXTITEM("cAttach2")
Set Attachment2 = File2.EMBEDOBJECT(1454, "", cAttach2, "cAttach2")
End If
'Sets up the 3rd embedded object and attachment and attach it
If cAttach3 <> "" Then
Set File3 = MailDoc.CREATERICHTEXTITEM("cAttach3")
Set Attachment3 = File3.EMBEDOBJECT(1454, "", cAttach3, "cAttach3")
End If
'Sets up the 4th embedded object and attachment and attach it
If cAttach4 <> "" Then
Set File4 = MailDoc.CREATERICHTEXTITEM("cAttach4")
Set Attachment4 = File4.EMBEDOBJECT(1454, "", cAttach4, "cAttach4")
End If

'Sends the document
MailDoc.Send 0, cRecipient

'Cleans things Up.
Set MailDB = Nothing
Set MailDoc = Nothing
Set Session = Nothing
Set File1 = Nothing
Set File2 = Nothing
Set File3 = Nothing
Set File4 = Nothing
Set Attachment1 = Nothing
Set Attachment2 = Nothing
Set Attachment3 = Nothing
Set Attachment4 = Nothing

'MsgBox cRecipient
'MsgBox cSubject
'MsgBox cBodyText

End Sub
 
did you see the message in the sent folder with all the columns set ?
I mean the Who column in the sent folder - does it have the emailid of the person you sent the email to..
 
I fixed the problem.

Actually I used a Dim recip(25) as Variant which has the list of email ids.
and I assign to the sendto field of lotusnotes document.

The sendto field has lot of trailing commas if I send my email to only 3 people. So I copied the recip elements to another array which as the dimension set to necessary email id's count.
 

Users who are viewing this thread

Back
Top Bottom