Mailing different users from a checkbox list

Hi to all,

I want to send a mail from a form, where the user selects a couple of customers from a checkbox list for example emailA, emailB, emailC

emailA = test1@gmail.com

emailB = test2@gmail.com

emailC = test3@gmail.com

Using @mailsend works perfectly for sending mail to all intended recipients.

Now the problem that I have is I want to send a e-mail one at a time to the different users, instead of to all at the same time.

Why I want to do this is because I don’t want emailA to see that I have send this mail to emailB and so on.

I have tried using BCC, but this is not always working correctly as different email programs you can actually see who is the BCC mail users.

Any help would be really helpful.

Subject: BCC should work…

BCC should work in hiding the other addresses…

But it is not hard to send to one address at a time, just loop though the addreeses.

Using Lotusscript (and my mail notification class you can find at Lotusscript: Mail Notification Class – TexasSwede), it would look like this:

Dim mail as NotesMail

Dim recipient(2) As String

recipient(0) = “user1@example.com

recipient(1) = “user2@example.com

recipient(2) = “user3@example.com

For i = 0 to Ubound(recipient)

Set mail = New NotesMail

mail.MailTo = recipient(i)

mail.Subject = “Test email”

Call mail.AppendText("Hello " + recipient(i) + “,”)

Call mail.AppendNewLine(2)

Call mail.AppendText(“This is just a test email.”)

Call mail.AppendNewLine(1)

Call mail.Send()

Next

Note: Never use mail addresses or mail domains that could possibly belong to someone. You may think it is a “made up” addresse, but it may belong to someone after all, who might get spam after you post their address online. Also don’t use existing domains like gmail. When you post sample code, use example.com, example.org, etc, they are intended for this exact use.

Subject: Mailing different users from a checkbox list

Hi Karl-Henry Martinsson,

Thanks for the reply can you just advise instead of hardcoding the email addresses into the code, how would I go about retrieving the list from a checkbox?

Why I am asking is because the user selects the Company names from a checkbox to whom they want to send the email, this in turn does a @dblookup to find the correct e-mail address which is connected to that Company’s name and then must mail out to the relevant email addresses chosen by the user.

Subject: Array

A checkbox field store the selecte davlues as an array, that is exactly why I used one.

valueArray = doc.GetItemValue(recipientChecklistField)

Since you now explain how you are getting the addreses, I would do something like this:

  1. Get the array of one or more selected company names from the checkbox field

  2. Loop through the array and get the corresponding email address (use the GetDocumentByKey method of the NotesView class for this)

  3. For each email address, send the mail using my NotesMail class (or your own code, if you like)