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

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

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

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

Thanks all :slight_smile:
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. :smiley:

3 Spice ups