in reply to Variable substitution

Each subject line with name in this case would print "Aaron Anderson" rather than that person's actual name. Can someone point out why this would happen?

Consider $subject. The first time into the loop, it might read  [name]! You can enlarge your whatever! Then you swap in a name, and send the first email.

So what is $subject going to be the second time through the loop?

Aaron Anderson! You can enlarge your whatever!
There's nothing left to substitute.

It looks like you need to make copies of both $subject and $messages each trip through the loop, and expand macros in the copies.