r/PowerShell • u/YourDadSolanki01 • Feb 25 '26
Infra health check script not sending mail
We are running our health checks with scripts. This script will generate html report and send mail attaching the html as attachment and also content in mail body to our group id but from last 2 days it is not sending mail . HTML file is getting generated successfully. We append html file on every run. Tested smtp with powershell smtp command it works fine by giving credentials but mail sending not working through this health check script. We have added TLS1.2 thinking it might be the issue. But same result. There is no change at SMTP end( same script working fine 2 days back). It was running under scheduled task, we tried to run it directly from Powershell thinking any issue with task or account.
Any idea what to check in this?
View all comments
Show parent comment
2
u/purplemonkeymad Feb 25 '26
I often hear this phrase when working on issues with clients. Just because it worked two days ago does not mean it's still not something you were doing wrong. Especially with emails, everyone is tightening the requirements.
Check your relay is in your spf and dkim is setup. Check the relay logs to know if it's even connecting. Put bad smtp details in your script settings to check that it is actually reporting sending errors to you. etc. Logs are the most important part of troubleshooting.