Receipient address changed to @wkldoinall.wk.dcx.com

Posted on 2004-11-18
Medium Priority
Last Modified: 2013-12-18

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
@wkldoinall.wk.dcx.com 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
Question by:cgikb2
  • 3
  • 3
  • 2
  • +1
LVL 19

Expert Comment

ID: 12613259
u need to enter person names as personname@domain.com

Ex: maddy@yahoo.com, maddy1@abc.com

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

LVL 46

Expert Comment

by:Sjef Bosman
ID: 12613288
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 ns1.sns-felb.debis.de

Author Comment

ID: 12613474
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 ?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 1600 total points
ID: 12613876
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
LVL 24

Accepted Solution

HemanthaKumar earned 400 total points
ID: 12614631
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 ?


Author Comment

ID: 12615420
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
LVL 24

Expert Comment

ID: 12616835
Use Ubound for array count
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12618256
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? ;)

Author Comment

ID: 12623247
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.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Loops Section Overview
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question