I've been running health checks using a script that generates an HTML report and sends it via email, both as an attachment and in the email body to our group address. However, for the past two days, it hasn't been sending emails, even though the HTML file is generated successfully. The script appends to the HTML file on each run. I confirmed that the SMTP server works fine with a PowerShell command using the same credentials, but the email sending through the health check script is not working. We added TLS 1.2 in case that was the issue, but the results remain the same. There's been no change on the SMTP side; the script was working perfectly two days ago. We also tried running it directly from PowerShell instead of through a scheduled task, thinking there might be an issue there. Any suggestions on what to check next?
4 Answers
What do your PowerShell logs indicate? And what about your antivirus logs? I've had to bypass ISP blocks before, so make sure that's not an issue here.
Try using Send-MailMessage directly in a terminal to mimic what the script does. Does it give you any errors? If not, look into your mail server logs to see if the send request is being received.
Check if your IP is still allowed to relay from the SMTP server. Since it was working just a couple of days ago, it's worth double-checking these settings.
Try adding logging to your script and also check the SMTP server logs for any errors. Instead of sending attachments, consider pointing the HTML output to a web server folder and sending a link via email. This could simplify the process and avoid unnecessary email clutter.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically