Are you familiar with the Get ( LastError ) function?
A simple approach would be to have a script step
Exit Loop If [ Get ( LastError ) ≠ 0 ]
right after the Send Mail script step.
You'll probably also want to add logging and reporting of errors, in which you could set the error code and other relevant information to variables/fields before exiting the loop. After the loop, you'll want to check against the errors logged, and take the appropriate action if an error was detected.
Maybe your provider considers sending more than 200 mails with 1 sec. interval as spamming ?
I am familiar with the Get ( LastError ) function. And we do have an error log. If there is an email error, the script goes on to the next record. This is what we want it to do.
What I'm asking is a little different. In this case the loop simply failed half way through the 400 odd records. We didn't find out until the client told us that several recipients hadn't received their emails.
Are you running it as perform script on server?
Loop scripts on WebDirect are somewhat flaky in nature depending on what you are trying to do, as the server is trying to evaluate the context from the user, process the action, return the result of the action to the user, and then repeat ad nauseum through the loop.
From what I've found, to no fault of filemaker, is that the timing in fast repetitive loops can sometimes get thrown off (EG new action starting before old one finishes), causing the server and client to fall out of sync and the script to fail for no reason.
Thus, any loop based data processing I always perform as PSoS so that the server takes care of the whole thing, and only returns results to the user.
BTW, Siplus's advice is sound, you should be using an email service like Mandrill or 360works CloudEmail rather than the send mail script step. Something that's designed to handle emails in volume.
That is possible, but I tested it with a dummy account sending to 400 records with no failures. We are sending out of a Google business account.
Thanks MIke, I'll check out CloudMail and Mandrill.
But still the question, if the loop just stops how can I notify myself of that failure?
I don't think you're hitting the limit in this particular case, but depending on the type of Google business account, there are limits to the number of e-mails you can send per day. But hitting that does trigger an error, 1506 if I recall correctly.
If you have an error log, what are the error codes you are getting?
Do you report these errors to the user (or yourself) at the end of the script? That might be a good idea to avoid issues like these going unnoticed for a long time.
Do you validate e-mail addresses entered?