Using Powershell to Send Emails via Mimecast

You can send emails via Mimecast instead of 365 , so you don’t need a licensed 365 user.

Login and enable SMTP Email submissions for that user

Use the users Cloud password and email address for Auth

$creds = get-credential

Send-MailMessage -From [email protected] -To [email protected] -Subject "Test Email" -Body "Test SMTP Service from Powershell on Port 587" -SmtpServer au-smtp-outbound-1.mimecast.com -Credential $creds -UseSsl -Port 587

 

If you see

Send-MailMessage : Unable to read data from the transport connection: net_io_connectionclosed

You need to create an Authentication profile with 2fa disabled , and apply it to that user via Application Settings

 

“Send-MailMessage : A call to SSPI failed, see inner exception”

Trying to send email comes back with this error , you need to change TLS1.2

‘ServicePointManager.SecurityProtocol’ is not recognized as the name

Trying to use

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
to Force TLS 1.2 doesn’t work 
 
 
Use 
 
# Enable TLS 1.2 as Security Protocol
[Net.ServicePointManager]::SecurityProtocol = `
    [Net.SecurityProtocolType]::Tls12 ;
 
 
 
 
 
 
GD Star Rating
loading...
GD Star Rating
loading...

Tags: 'ServicePointManager.SecurityProtocol' is not recognized as the name, "Send-MailMessage : A call to SSPI failed, mimecast, net_io_connectionclosed, powershell, see inner exception", smtp

Trackback from your site.