WordPress sending emails continuously. How to stop it?
The problem I think the problem here is that you’re generating an infinite loop, by placing wp_mail() inside the $phpmailer->action_function callback, that fires after each email. Each time you send an email with wp_mail(), you call wp_mail() again, and again, and again … etc Possible workaround You should instead use, for example, the following approach: … Read more