Corey,
I think you're onto something here. I do not quite understand what you mean by
Why are you referencing $message in setting the variable itself. $message has not been set to anything in the code you've shown us.
I moved the multipart boundary part above because I thought it was causing double headers. Now, I was only testing with two emails and the second would be sent to the correct email but would have the first name in the list and it would have two attachments with two headers. Now after your message I think you're right, if I tested with 10 email, my last email would still be sent to the correct address, first name and have 10 attachments...
The code in the original message is all I'm using. I use this code to send individual requests, but I thought I could modify it to send to a list. So going back to your message, I got the SECOND point, but am a bit confused with the first one.
Do you mean I need to rework the code to put it in the following order:
// 1. get file params first
// 2. if the file exists do the followingn
// 3. get the list of users that match the criteria and run the loop
// 4. filter to keep the ones that can be emailed only
// 5. build the $message and attach the file
// 6. email and start with the next name
Isn't it what I need to do? I sense there's some mix up somewhere but just can't pin pint it. Do you say I'm missing something in my original code? I've been staring too long on this piece, can't seem to get it right. Help!!!!!!!!!