Forum Discussion
Khan Mansoor KHAN
May 01, 2018Copper Contributor
Domain Controller Monitoring with PowerShell using 0365 SMTP rely
Dear Techies, I am trying to monitor my domain controllers using below powershell script. However, I am unable to associate 0365 SMTP rely server in the script. Since I am not very good at power...
Mitch King
May 01, 2018Iron Contributor
You need to authenticate to use the Office 365 service as a relay
$SMTP.Credentials = New-Object System.Net.NetworkCredential("username", "password");
- Marty GroganMay 18, 2018Copper Contributor
PowerShell requires that a user enter credentials through a dialog to send email. Some devs have found a way to store creds in a text file and accomplish this action.
I have also discovered that creating a MailMessage object using purely strings does not authenticate. The From entry must be a MailAddress object. Personally, I think this to be a bug.
- Mitch KingMay 01, 2018Iron Contributor
https://stackoverflow.com/questions/12460950/how-to-pass-credentials-to-the-send-mailmessage-command-for-sending-emails