Spread the love
Trying to test the Office365 SMTP Relay Service to troubleshoot an issue I had with email sending today I came across this little useful command in PowerShell. All I had to do is enter the credentials and then send a test email.
- To open PowerShell right-click the start button and Choose Windows PowerShell.
- Enter the following command
$msolcred = get-credential
- A window pops up. Enter your office365 credentials there.
- Then use the Send-MailMessage command to send a test email
Send-MailMessage –From georgia.k@c***i.gr –To georgia.k@c***i.gr –Subject “Guess what!” –Body “I am Testing the SMTP Relay Service from PowerShell” -SmtpServer smtp.office365.com -Credential $msolcred -UseSsl -Port 587
- If there is no error check your inbox for a new email!
If there are any connectivity or other issues, you can see the error and troubleshoot accordingly.