Mass e-mail using LotusScript

I created a Lotus Script mass e-mail list to send out notices to people who are scheduled for training. We use a large group of seasonal staff, and sometimes they will be put in for training, but let go before training starts. When the e-mail notice goes out, the script stops on the removed employees and does not process anyone after the name. I would like to add code to verify the e-mail addresses and skip any that are not valid. Here is the current code.

Call doc1.Send( False, doc.student(0) )

Set doc=collection.GetNextDocument(doc)

counter=counter-1

Subject: two suggestions

add:

On Error Resume Next

near the top of your agent.

Also, create a view that does your validation for you ( I am assuming you mean “validation” means there is in fact an email address)

The view could have a Selection Formula something like:

SELECT form = “Person” & MassEmailActive = “1” & MailAddress!=“”

Then the mass mailings would use this new view as its base of operations.

That is just the FLAVOR of how I would approach it, I am guessing at item names and such without looking.

Good luck.

Matt

Subject: RE: two suggestions

NO TO ON ERROR RESUME NEXT! Worse error trapping possible:-)/

Assuming the employees have not been flagged in this application, you will need to check for their existence in the domino directory before sending the message.

Subject: RE: two suggestions

Resume Next does occasionally have a use … but I wouldn’t use it here either.

Subject: RE: two suggestions

As a trade-off, “On Error 4294 Resume Next” could be used.

Subject: RE: two suggestions

NO NO NO!

Resume Next should NEVER be used. All errors should be handed off to an eror handler so that the error can be logged. Yes, I am saying you log ALL errors for control purposes.

Subject: RE: two suggestions

I’m afraid I have to disagree, at least in terms of logging everything. There are error types that one should expect and code around – things that aren’t errors in the sense of “didn’t go as planned”. Like, for instance, attempting to add a second instance of a view entry object to a view entry collection, which will arise as a natural consequence of walking a categorised view. Specifically handling expected error types with their error number is the right thing to do It’s the equivalent of:

catch(IKnewThatWouldHappenException e) {/* this error is expected and handled silently */}

Subject: RE: two suggestions

well the lets meet halfway. Instead of doing resume next, throw it to an error handler and process the error based on whatever rules you decide.

BUT, in the example you give, logging the error would help the developer find the errors in his code he/she did not know about?

Subject: RE: two suggestions

I’ll go along with the handler, maybe, but a declarative On Error ErrorNum Resume Next is more efficient than a select case in what amounts to a gosub. I will stress, though, that the developer had better be sure that the “skip it” method is safe in a given situation. In the example, I’d Resume Next on error 4414 (lsERR_NOTES_ADDENTRY_DUP), but not on error 4415 (lsERR_NOTES_ADDENTRY_FAILED), which should at least be logged.

For clarity and an injection of sanity here, I’m a firm believer in error trapping and logging, to the point that a significant portion of the LS I write sets environment flags and assesses severity levels. When I write to the log, I write a novel, not just (Err, Error & " " & Erl). (That’s hard on agentlog.nsf on my test machine – a stupid mistake can write gigs.)