#8331

You add the Utilities.doevents lines in order to prevent Groupwise from crashing, don’t you? Unfortunally this does not solve my problem as Groupwise still crashes after sending 140 – 160 messages.

Here is what I do:
The first step is select 1 address book to which the message will be send.
The second step is enter a subject line and the messagebody in a Formativ form
Optionally, an attachment can be selected

After these steps, my applet enters its main loop, i.e. sending the message to each contact in the selected address book. In the body a greeting will be inserted on the first line. This greeting is stored in the contacts comment field. This is how I create and send the message:

for Each AdressBookItem in AddressBook
if AdressBookItem.emailaddress <> “” Then
‘ Create new mail message
Call GroupWise.NewMail
‘ Enter the recipient
Call GroupWise.FocusSet(fcsTo, “”)
Call GroupWise.TypeText(AdressBookItem.emailaddress)
‘ Enter the subject
Call GroupWise.FocusSet(fcsSubject, “”)
Call GroupWise.TypeText(mailbericht.mailberichtEdit1.text)
‘ 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(AdressBookItem.Comments)
call GroupWise.TypeText(chr(10) & chr(13))
Call GroupWise.TypeText(mailbericht.mailberichtMemo1.text)
‘ Add attachment if any
If bijlage <> “” Then
call GroupWise.ItemAttachmentAdd(“X00”, itcAttachClassFile, bijlage, “”)
end if
‘ Send the message
Call GroupWise.ItemSend(False)
Utilities.doevents
end if
next

But this is quite tricky, as user intervention might disrupt the creation and sending the message. And if the user doesn’t touch the computer, it always crashed after sending about 150 messages.

So I tried to change the main loop to:

for Each AdressBookItem in AddressBook
if AdressBookItem.emailaddress <> “” Then
‘ Create new mail message
Call GroupWise.NewMail
‘ Add the recipient and subject
GroupWise.CurrentItem.To_=”roland.leurs@trippler.nl”
GroupWise.CurrentItem.Subject=mailbericht.mailberichtEdit1.text
‘ Add the message body, first add the greeting from contact comment field
‘ after that add the text as type in the previous window
GroupWise.CurrentItem.Body=AdressBookItem.Comments & chr(10) & chr(13) & mailbericht.mailberichtMemo1.text
‘ Add attachment if any
If bijlage <> “” Then
call GroupWise.ItemAttachmentAdd(“X00”, itcAttachClassFile, bijlage, “”)
end if
‘ Send the message
Call GroupWise.ItemSend(False)
Utilities.doevents
end if
next

… trying to avoid the focus and typetext methods. But the subjects, to and body fields are left blank. Is this basically wrong, as I do not get any run-time or compilation error messages. After the “Call GroupWise.ItemSend(False)” command Groupwise displays a message box and says I have to enter a recipient in the To field. I’m using GW7, dutch version.

How can I send hundreds of mail with a personal greeting if this doesn’t work?

Thanks for your support,
Kind regards,
Roland Leurs