Up 0 Down 0

Test Office 365 Connector

Test Office 365 connector using PowerShell:

Send-MailMessage -From info@office365domain.com -To user@otherdomain.com -Subject "Test Email" -Body "Test SMTP Service from Powershell on Port 25" -SmtpServer domain-com.mail.protection.outlook.com -Port 25

HTML message test:
# Set variables
$MailFrom = "from@domain.com"
$MailTo = "to@otherdomain.com"
$Username = "username@domain.com"
$Password = "password"

# Test message
$SmtpServer = "smtp.office365.com"
$SmtpPort = "587"
$MessageSubject = "Test Subject" 
$Message = New-Object System.Net.Mail.MailMessage $MailFrom,$MailTo
$Message.IsBodyHTML = $true
$Message.Subject = $MessageSubject
$Message.Body = @'





This is a test message.


'@

# Construct the SMTP client object, credentials, and send
$Smtp = New-Object Net.Mail.SmtpClient($SmtpServer,$SmtpPort)
$Smtp.EnableSsl = $true
$Smtp.Credentials = New-Object System.Net.NetworkCredential($Username,$Password)
$Smtp.Send($Message) 

OpenSSL:
openssl s_client -starttls smtp -crlf -connect smtp.office365.com:587
ehlo
auth login

334 VXNlcm5hbWU6
Encode username using: https://www.base64encode.org
dXNlckBkb21haW4uY29t

334 UGFzc3dvcmQ6
Encode password using: https://www.base64encode.org
dXNlcnNwYXNzd29yZA==

mail from:sender@domain.com
rcpt to:recipient@remotedomain.com
data

subject: test message
2x Enter
test
.

quit