Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

MS Access - Lotus Notes multiple CC

Posted on 2011-05-08
14
Medium Priority
?
513 Views
Last Modified: 2013-02-22
Hello,

I am using the following code to send email from Access thru Lotus Notes.

Function NotesMailSend(strRecipient As String, strCC As String, strSubj As String, strBody As String)

On Error GoTo Err_NotesMailSend

   Dim objNotes As Object
   Dim objNotesDB As Object
   Dim objNotesMailDoc As Object
   
   Set objNotes = GetObject("", "Notes.Notessession")
   Set objNotesDB = objNotes.getdatabase("", "")

   Call objNotesDB.openmail
   Set objNotesMailDoc = objNotesDB.CreateDocument

  Call objNotesMailDoc.replaceitemvalue("SendTo", strRecipient)
  Call objNotesMailDoc.replaceitemvalue("CopyTo", strCC)
  Call objNotesMailDoc.replaceitemvalue("Subject", strSubj)
  Call objNotesMailDoc.replaceitemvalue("Body", strBody)
 


   Call objNotesMailDoc.Send(False)

   MsgBox "Mail Sent", vbInformation, "Sender notes-mail..."

   Set objNotes = Nothing

Exit_NotesMailSend:
   Exit Function

Err_NotesMailSend:
   MsgBox Err.Description
   Resume Exit_NotesMailSend


 It works great if I only have 1 email in the CC, BUT, I need 4 emails in CC.  They are going to general emails so they will not be changing.  EX - box1@acme.com,  box2@acme.com, box3@acme.com,box4@acme.com.  

How do I build the string of email addresses?  When I send the email it cuts off the last "@acme.com.

Suggestions?  Hard coding is OK.

Thanks,

Trish
0
Comment
Question by:Halia
  • 8
  • 5
14 Comments
 
LVL 3

Expert Comment

by:wuesten_fuchs
ID: 35718727
To add multiple addresses, you would use an array of strings as the argument to ReplaceItemValue.

In addition, in Lotus Notes the separator between multiple values for an address field would be the semicolon, not the comma. But it would most probably not help in this case. You need to pass an array of strings.
0
 

Author Comment

by:Halia
ID: 35719353
I just checked my lotus notes and it is a comma s the CC values eparating.

0
 
LVL 3

Expert Comment

by:wuesten_fuchs
ID: 35719362
Oops, you are right. I wanted to make sure that this point is clear but actually got it exactly wrong. It's a semicolon in Outlook and a comma in Notes.

Anyway, the point is not semicolon vs. comma but that you need to pass an array to this function for multiple values (Notes multi value items are represented as arrays).
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Halia
ID: 35719365
Sorry, typo in last comment.  It is a comma separating the values in lotus notes CC.
0
 

Author Comment

by:Halia
ID: 35719374
Can I do that with the code I'm using?  Also, is there no way to just hard caode the email addresses?
0
 
LVL 3

Expert Comment

by:wuesten_fuchs
ID: 35719391
Whether you hardcode or not - it should be an array.

Using an array for this purpose is no big deal.

Dim cclist(3) as string
cclist(0) = "billg@microsoft.com"
cclist(1) = "obama@whitehouse.gov"
cclist(2) = "pope@vatican.com"
...
Call objNotesMailDoc.replaceitemvalue("CopyTo", cclist)

That should work. At least, it works in LotusScript but should do in VB as well.
0
 

Author Comment

by:Halia
ID: 35719420
Thank you!  I will give that a try and let you know if it works!
0
 

Author Comment

by:Halia
ID: 35719495
When I try to add the (4) after my strCC, I am getting a complileverror -

Org - Function NotesMailSend(strRecipient As String, strCC As String, strSubj As String, strBody As String)

New - Function NotesMailSend(strRecipient As String, strCC(4) As String, strSubj As String, strBody As String) - this gives me a compile error.

What am I doing wrong?
0
 
LVL 3

Expert Comment

by:wuesten_fuchs
ID: 35719542
You cannot declare a parameter as an array. I am not a VB expert, but in LotusScript you would pass it as a Variant.
0
 

Author Comment

by:Halia
ID: 35719622
Thank you, I'll figure it out
0
 

Author Comment

by:Halia
ID: 35719944
I think I figured out what I need to do but I can't test it until this evening.  I will let you know if it works.

Thanks for steering me in the right direction!

Trish
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 2000 total points
ID: 35721702
Try this as well:

  Call objNotesMailDoc.replaceitemvalue("CopyTo", Split(strCC, ','))
0
 
LVL 3

Expert Comment

by:wuesten_fuchs
ID: 35722442
Good point. Split is returning an array of strings ...
0
 

Author Comment

by:Halia
ID: 35724744
("CopyTo", Split(strCC, ','))
 THIS WORKED!!!!!!

Thank you so much!
0

Featured Post

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.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Implementing simple internal controls in the Microsoft Access application.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

577 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