I have a scheduled task that will check for passwords expiring in 15 days or less and fire off a reminder email to the user that they have x days left to change it. However, there are usually 70+ addresses in this list and after 10 messages are sent the following error appears:
The server response was: #4.x.2 Too many messages for this session
The script will continue and then after 10 more, the same error. I have even moved the function using send-mailmessage to a separate .ps1 file and call it from the parent .ps1 but the error continues. I don't want to bump up the concurrent connection limit on my relay, is there any clean way to close the send-mailmessage session? Otherwise I'll probably just loop the task to catch the error condition. For what it's worth, the server running this task has .NET 4.0 installed.