So you need a simple SMTP relay test? You can do it with P0werShell!
- 
 So you need a simple SMTP relay test for Office 365 
 IntroductionI have been doing a ton of Exchange migrations lately and setting up internal IIS relays to smarthost to Office 365. In this I have found many issues with firewalls and various settings IT managers like to do to keep email traffic limited. In this I have had to figure out ways to test SMTP from telnet to PowerShell and this one is my favorite so I thought I would share. Steps (4 total) 
 1
 Open PowerShell
 Right Click on PowerShell and Run As Administrator2 
 Store your Office 365 Mailbox Credentials
 get-credential will prompt you for the Office 365 relay mailbox creds. you need to store this in a variable so you can call it as one bit in the next command line.$relaycreds = get-credential 3 
 Use Send-MailMessage PowerShell Command
 now we can use the creds above to send a test email message using the Send-MailMessage command. [email protected] to the same user #you just stored the relaycreds in step one. [email protected] to another email address you have under your control so you can see it relay.Send-MailMessage –From [email protected] –To [email protected] –Subject “Test Email” –Body “Test SMTP Relay Service” -SmtpServer smtp.office365.com -Credential $relaycreds -UseSsl -Port 587 4 
 Test the SMTP Relay
 use the same command with a few changes to test the SMTP relay now.Do this from the server with IIS6 SMTP relay on or change localhost to the FQDN of your choice.Send-MailMessage –From [email protected] –To [email protected] –Subject “Test Email” –Body “Test SMTP Relay Service” -SmtpServer localhost -Port 25 Conclusion So really simple way to send emails now and you can see also from this command the ability to email from a scheduled task attached to event triggers. This will help you monitor your windows servers for those specific events that you care about. Good luck 
- 
 Awesome, that is pretty cool. Thanks. 
- 
 Thanks! 
- 
 Thanks! I was just talking about this with a friend the other day. 
- 
 Cool. This would have been handy for me to have a couple of years ago. 
- 
 Nice one. 
- 
 Good one, thanks. 
- 
 Thanks! 
- 
 Port parameter wasn't introduced until PowerShell 3.0, so you'll need to make sure you're on at a minimum of that before this will work. PowerShell 4.0 is the current version and 5.0 is coming out SOON. So if you're still on 2.0, upgrade now! 







