-
Topic
-
We are trying to use a GroupWise address book for a mass mailing, similar to the “Quick Send” applet. Instead of using a text file, we want to use a field from the Addressbook/contacts folder.
The applet works fine for a single attachment, but not for multiple attachments.
We’re using the trial version of Formativ Studio (purchasing is underway with a US vendor) and GroupWise 7.0.
Here’s the script:
Sub Main(Client, GWEvent)
Dim objAddressBooks
Dim objAddessBook
Dim objAddressBookEntry
Dim objSubject
Dim objMessage
Dim objMsg
Dim objAttach
Dim objAttachs
Dim iAttachCounter
Dim iMsgIDSet objMsg = GroupWise.ComposingItem
objSubject = objMsg.Subject
objMessage = objMsg.BodyText‘ Get the composing message ID through TOKEN
iMsgID = GroupWise.ItemMessageIDFromView
‘ Make sure we have a composing message selected
iAttachCounter = GroupWise.ItemAttachmentGetCount(iMsgID)
if (iAttachCounter > 0) then
for x = 0 to (iAttachCounter -1)
objAttach = GroupWise.ItemAttachmentGetName(iMsgID, x)
msgBox(objAttach)
next
end if
‘ Get the AddressBooks object
Set objAddressBooks = GroupWise.Account.AddressBooks
‘ Locate the address book called ‘Address Book’Set objAddressBook = objAddressBooks.Item(“Contacts for Newsletter”)
‘ Display the email address of each entry in the book
For Each objAddressBookEntry In objAddressBook.AddressBookEntries
if objAddressBookEntry.emailaddress <> “” Then
‘ Create new mail message
Call GroupWise.NewMail
‘ Enter the recipient
Call GroupWise.FocusSet(fcsTo, “”)
Call GroupWise.TypeText(objAddressBookEntry.emailaddress)‘ Enter the subject
Call GroupWise.FocusSet(fcsSubject, “”)
Call GroupWise.TypeText(objSubject)
‘ Enter the message body, first insert the greeting from contact comment field
‘ after that enter the text as type in the previous window
Call GroupWise.FocusSet(fcsMessage, “”)Call GroupWise.TypeText(objMessage)
‘ Add attachment if any
if (iAttachCounter > 0) then
‘ Loop through attachments to get the names
for x = 0 to (iAttachCounter -1)call GroupWise.ItemAttachmentAdd(“X00”, itcAttachClassFile, objAttach, “”)
next
end if‘ Send the message
Call GroupWise.ItemSend(False)
Utilities.doevents
end if
nextSet objAddressBook = Nothing
Set objAddressBooks = Nothing
Set objMsg = NothingEnd Sub
- You must be logged in to reply to this topic.