Add everyone in folder to my address book

We set up two email groups (groupA, groupB) in our comapny for a promotion were running and manually moved those emails into one of two folders (groupAemails, groupBemails) once they were received. Now that the promotion is over I need to email everyone in the GroupAemails folder. How do I do that? There are around 300 in there and I dont want to do it one at a time, please help!

Subject: Add everyone in folder to my address book…

Create a button in the action bar of each folder; set to LotusScript.

Sub Click(Source As Button)

On Error Goto errhand

Dim s As New notessession

Dim db As notesdatabase

Dim mailDoc As notesdocument

Dim mailUI As notesuidocument

Dim w As New notesuiworkspace

Dim dc As notesdocumentcollection

Dim doc As notesdocument

Dim sendTo As notesitem



Set db = s.currentdatabase

Set dc = db.unprocesseddocuments

If dc.Count < 1 Then

	Msgbox "You must select at least one class document in order to proceed."

	Exit Sub

End If





Set mailDoc = db.createdocument

mailDoc.Form="memo"

Set sendTo = New NotesItem( mailDoc, "SendTo", "" )

Set doc = dc.getfirstdocument

While Not doc Is Nothing

	Call sendTo.appendtotextlist(doc.SendTo(0))		

	Set doc = dc.getnextdocument(doc)

Wend



Call mailDoc.Save(True, True)

Set mailUI = w.EditDocument(True, mailDoc)

Exit Sub

errhand:

Msgbox  "error # " & Str(Err) & " at line " & Erl & ":  " &  Error

Exit Sub

End Sub

Subject: RE: Add everyone in folder to my address book…

Thanks Esther, I love simple code such as the one you gave me! However, it only sends replies back to the “group” instead of the individual? Simple modification in the code?

For example, when running the script I got “groupA” in the To: field about 300 times (one for every user) instead of the users email address.

Lets say you ( EstherStrom@email.com ) send an email to groupA@MyCompany.com, I would then take your email and move it to a groupA folder once I looked at it. Mutiply that process times 300 over the course of 12 months. Now I want to email everyone in that folder because the promotion is over. When I run the action button, instead of your email address in the To: field, im getting the name of the group (groupA) you sent the email too. It replys correctly when I highlight the email, then go to

Hopefully I just clarified things instead of making them more confusing?

Subject: RE: Add everyone in folder to my address book…

Hi Jeremy,

Esther’s code is near perfect… just change the line:

Call sendTo.appendtotextlist(doc.SendTo(0))

to

Call sendTo.appendtotextlist(doc.From(0))

and you will get what you are looking for.

Cheers,

Mark

Subject: RE: Add everyone in folder to my address book…

I Love you man, Sniff Sniff. Works perfect! Thanks - BOTH Of YOU!