I am using a debian server and for some reason when I run this php script using crontab every minute it says that I am using 99% of the %CPU with the php command (in the cronjob the command is php) and the emails will not send. Eventually it says I am out of memory in the tmp folder. The weird part is that for about 10 minutes the cronjob worked perfectly; it sent me the emails every minute and the CPU usage was very low which was good. After that 10 minutes though, the CPU percentage spiked to about 99% again and the emails stopped sending.
If I manually send this email using the command: "php mail1.php", I receive the email with all the contents and there are no problems. With cronjob sending them, I can't even receive 1 anymore. If anyone has any idea why please let me know. Thanks
UPDATE: the server was being finicky so I deleted and retyped the same code over again, as well as deleting and recreating the same cronjob and it works properly.