- September 27, 2020
- Posted by: Syed Shujaat
- Category: Uncategorized
Firstly open up Powershell (Must be v3 or greater), then copy/paste the following command,
$creds = get-credential
When prompted, enter the Office 365 username and password which you plan to run the test from.
Once these credentials are stored in a variable, copy and paste the next snippet replacing the FROM field with your Office365 account that you have just specified in your credentials then specify a valid TO address,
Send-MailMessage –From <O365 email address> –To <Recipient email address> –Subject "Test Email" –Body "Test SMTP Service from Powershell on Port 587" -SmtpServer smtp.office365.com -Credential $creds -UseSsl -Port 587
All being well the email should be successfully delivered.
If you get the following error message when running the command, you need to ensure you are running Powershell version 3 or greater
Send-MailMessage : A parameter cannot be found that matches parameter name ‘Port’.
TELNET
You can also use Telnet Because O365 uses TLS You can’t really get far using Telnet on its own besides connecting to the server.