One more comment then I will shut up.
I talked about how I wrote out a phsyical file and then I went and processed the email out of it, one record at a time. I put all the formatting of the email in that so that if I needed to reword the email, etc. I was playing in a simple program, not something more complex.
There are several ways to send the email, one being using what you saw probably over at easy400, bob's tool, mailtool. There is another way you can do all this.
You can create a single file that all your email records are in, and at the end of each email set, put in a record like ^^^email@example.com† (the email address to send to).
Then you can ftp this to a pc and write a quick vb dot net or c# dot net program that will break this down into dozens or hundreds of files into a folder and then use a product like gammadyne mailer to mail it out OR use the vb.net program to actually email each. That would mean that you would have to do like an strpco and strpccmd (or aaron bartell's rpg2desktop) to trigger the pc side of things.
Long ago we used to have thousands of daily tracking to send, all at the end of the day, the i (at that time as/400) created a single file (actually 2, the single file with them all and a simple csv file OR a single csv file that you do parameter subs in gammadyne) and we then let gammadyne mailer send them out. Since getting mailtool we now send them from the i side of things.
In what I decribe here there is no need for the ifs.††I simply wanted to give you an alternative method. For example with tieing in gammadyne mailer on the pc side of things, it could be as simple as:
etc.† and in gammy you can make compares so that you give different hyperlinks if it is ups or fed ex, etc.
I think gammadyne mailer on the pc side of things is the greatest tool there is. I have probably sent upwards of 250 million or more emails with it.