How to send a New Message using SMTP in Office365


I found this question coming too often :) so, I thought it would be interesting to share it here!

First you can check and review How to set up a multifunction device or application to send email using Office 365, as it will guide you through the possible options:

  1. SMTP submission
  2. Direct send
  3. SMTP relay

I will describe a showcase a quick example for the first one.

SMTP Client Submission

If your device or application can authenticate and send email using an Office 365 mailbox account, this is the recommended method. The device or application sends mail using SMTP client submission. In the following diagram, the application or device in your organization’s network uses SMTP client submission and authenticates with a mailbox in Office 365.




  • Authentication: You must be able to configure a user name and password to send email on the device.
  • Mailbox: You must have a licensed Office 365 mailbox to send email from.
  • Transport Layer Security (TLS): Your device must be able to use TLS version 1.0 and above.
  • Port: Port 587 (recommended) or port 25 is required and must be unblocked on your network. Some network firewalls or ISPs block ports—especially port 25.


You can only send from one email address unless your device can store login credentials for multiple Office 365 mailboxes. Office 365 imposes a limit of 30 messages sent per minute, and a limit of 10,000 recipients per day.


Windows Key -> PowerShell (hit enter) -> Type

$mail = New-Object System.Net.Mail.MailMessage( "" , "" )
$mail.Subject = "Correo enviado desde powershell"
$mail.IsBodyHtml = $true
$mail.Body = @"
How to send an email using SMTP Office365 and PowerShell<br>
Check technet for details.

$client = New-Object System.Net.Mail.SmtpClient( "" , 587 )
$client.EnableSsl = $true
$client.Credentials = New-Object System.Net.NetworkCredential( "", "password" )
$client.Send( $mail )