As @Bawolff pointed out,
- Queries to user table should be done in batches, as opposed to 1 by 1. Especially if there are a lot of subscribers.
- How does this function scale. Will there ever be more than say 20,000 subscribers to a newsletter? More than 100,000 subscribers? Might have to put things like this in the job queue if the number of subscribers is large.