Shandy
(Shandy)
1
Been using this since mid 2023
Send-Mailmessage -smtpServer $smtpServer -from $from -to $reportTo -subject $reportSubject -body $reportbody -bodyasHTML -priority High -Encoding $textEncoding -Attachments $logFile -ErrorAction Stop
and now since around week of the 12th May 2025 it stops working with:
Unable to read data from the transport connection: net_io_connectionclosed.
Any ideas anyone please?
3 Spice ups
Rod-IT
(Rod-IT)
2
It doesn’t say what SMTP server you are using, who are you sending it from?
Most services now, except your own internal ones no longer support BASIC authentication, so it could be this.
The fact it says connection closed is either because it doesn’t like your content (if it’s BASIC) or something else about the service isn’t working.
Without knowing what $smtpserver is though, it’s hard to diagnose.
2 Spice ups
Shandy
(Shandy)
3
It’s the company’s smtp server, the script checks all the users AD password expiry dates and warns people if their passwords are due to expire within 2 weeks.
FYI, we’re an hybrid site, if that helps.
2 Spice ups
Rod-IT
(Rod-IT)
4
Have you restarted the service or server?
Looked at any SMTP logs to see why?
2 Spice ups
Or to ask it a different way, what all HAVE you tried so far?
1 Spice up
Shandy
(Shandy)
6
Thanks all 
All looks to have been sorted, the issue was a dummy user which was created in the production OU didn’t have an email address set in AD, after adding a random email address all is now working as it should. 
3 Spice ups