Receipient address changed to


I need your help with a very
difficult problem I encountered with Lotus Notes 5.07a. I'm using the
OLE-Interface to automatically generate and send e-mails from a MS-Access
97 database (no spam of course and just to colleagues). A generated e-mail
should be delivered to several people so I'm constructing a receipient
list, comma separated. After sending the mail, the SENT MAIL folder
contains the e-mail with the receipient list as generated. But only the
first receipient is actually receiving the mail and in this mail one can
see that all the other addresses have been changed to and of course were not delievered. So my question
is: What mechanism is changing the addresses of the 2. to nth receipient
and why and what can I do to prevent this. Any hint will be very much
appreciated. Thank you very much in advance.    Regards    Karl
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

u need to enter person names as


something like that. I think your receipient list is wrong.

Sjef BosmanGroupware ConsultantCommented:
Could you share some of the code with us, so we can see how you create the addresses and how you call the send-function?

Other suggestions:
- could you move from OLE to COM? Notes supports COM quite nicely
- in COM, the list of recipients should not be comma-separated, but it should be an array of strings, each string being one recipient

The domain seems to be yours, it points to
cgikb2Author Commented:
Tahnk you both for your response

To madheeswar:
I'm sorry, I just copied that part of the address that changed. It actually is preceded by a personname of course.

To sjef_bosman:
well, changing to COM would mean doing a re-write of the function, so first let's try it with OLE. You asked for the code - here it is:
Public Function SendNotesMail(Subject As String, Attachment As String, ByVal Recipient As String, ByVal str_CC As String, BodyText As String, SaveIt As Boolean) As String
'Set up the objects required for Automation into lotus notes
    Dim Maildb As Object 'The mail database
    Dim UserName As String 'The current users notes name
    Dim MailDbName As String 'THe current users notes mail database name
    Dim MailDoc As Object 'The mail document itself
    Dim AttachME As Object 'The attachment richtextfile object
    Dim Session As Object 'The notes session
    Dim EmbedObj As Object 'The embedded object (Attachment)
    Dim Nachricht As String
    Dim Zeichen As Byte
    Dim str_Pfad As String
    Dim I As Integer
    Dim absender As String
    Dim n As Integer
    'Start a session to notes
    Set Session = CreateObject("Notes.NotesSession")
    'Get the sessions username and then calculate the mail file name
    'You may or may not need this as for MailDBname with some systems you
    'can pass an empty string
    UserName = Session.UserName
    MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
    'Open the mail database in notes
    Set Maildb = Session.GetDatabase("", MailDbName)
     If Maildb.IsOpen = True Then
          'Already open for mail
     End If
    absender = Session.CommonUserName
    n = InStr(1, absender, " ")
    If n > 0 Then
       absender = Mid$(absender, n + 1, Len(absender))
    End If
    'Set up the new mail document
    Set MailDoc = Maildb.CreateDocument
    MailDoc.Form = "Memo"
    MailDoc.sendto = Recipient
    MailDoc.copyto = str_CC
    MailDoc.Subject = Subject
    Open BodyText For Binary As #1
    While Not EOF(1)
       Get #1, , Zeichen
       Nachricht = Nachricht + Chr(Zeichen)
    Close #1
    Nachricht = Left$(Nachricht, Len(Nachricht) - 1)
    str_Pfad = ActiveWorkbook.FullName
    I = Len(str_Pfad)
    While Mid$(str_Pfad, I, 1) <> "\"
       I = I - 1
    str_Pfad = Left$(str_Pfad, I)
    Open str_Pfad + "MailFooter.txt" For Binary As #1
       While Not EOF(1)
       Get #1, , Zeichen
       Nachricht = Nachricht + Chr(Zeichen)
    Close #1

    MailDoc.body = Nachricht
    MailDoc.SaveMessageOnSend = SaveIt
    'Set up the embedded object and attachment and attach it
    If Attachment <> "" Then
        Set AttachME = MailDoc.CreateRichTextItem("Attachment")
        Set EmbedObj = AttachME.EmbedObject(1454, "", Attachment, "Attachment")
        MailDoc.CreateRichTextItem ("Attachment")
    End If
    'Send the document
    MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
    MailDoc.Send 0, Recipient
    'Clean Up
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj = Nothing
    SendNotesMail = absender
End Function

I tried your suggestion with the array but it failed in an interessting way: The document in the SENT MAIL folder had no recipients and the recipient got a mail with the original error.

I made the following assignment:

MailDoc.sendto = Recipient_1

where Recipient_1 was defined as array of strings. Or should I use the address-operator & in this case ?
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Sjef BosmanGroupware ConsultantCommented:
Recipient_1 should be an array of strings, probably something like this (my VBA is a bit rusty..):

    Dim Recipient_1(2) As String

    Recipient_1(0)= "Tom Doe/Org"
    Recipient_1(1)= "Dick Doe/Org"
    Recipient_1(2)= "Harry Doe/Org"
    maildoc.sendto= Recipient_1

    mailDoc.send 0 ' 2nd parameter not required
Your problem as mentioned by SJEF is occuring due to the fact that "ByVal Recipient As String" ... passing the recipeint list as one complete string...

In that case.. notes takes the name value upto the first comma seperator and ignore or fail in conversion.

The answer to your question is pass the recipient value as array.

BTW, Do you work for DaimlerChrylser ?


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cgikb2Author Commented:
To sjef_bosman and HemanthaKumar:
I just tried it out and only the first recipient received the massage. One improvement I got: No address was changed. I tried it with Internet-style- and Lotus-style addresses. So I assume using an array is one right step. The only missing step is how to tell Lotus how many recipients there are - any ideas ?

Thanks for yoour good support
Use Ubound for array count
Sjef BosmanGroupware ConsultantCommented:
You need to create as many entries in the array as there are recipients, e.g. use Redim Preserve for that purpose. Or if there is a VB-function that will split a string on a certain symbol (the comma) into an array of strings (like in JavaScript), then use that one.

Massage? Ist das freudianisch? ;)
cgikb2Author Commented:
To sjef_bosman and HemanthaKumar:

Thank you very much both of you. The code is now running with this array method. I just overlooked one detail: The MailDoc.Send instruction still passed the original Recipient variable instead of the new Recipient_1 Array-variable.

Keep up the good work and thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.