#Server response was 5.7.3. STARTTLS is required to send mail

6 messages · Page 1 of 1 (latest)

spring sleet
#

Having a hard time getting powershell to email myself, testing so I can setup a disk space alert script on pc's with task scheduler.

Here is what I have so far;

send-mailmessage -SmtpServer 'outlook.office365.com' -port 587 -from [email protected] -To [email protected] -subject 'test' -body 'test'

I've tried with port 25 as well as smtpserver office365.com although different response on changing the smtp server.

karmic warren
#

Add -UseSsl

silver gull
open storm
#

for public services (if for some reason the graph option doesn't work out), you really need to get off Send-MailMessage and move over to MailKit. There are a few modules implementing a Send-MailMessage type command: https://www.powershellgallery.com/packages?q=mailkit

spring sleet
#

I'll try these suggestions out Monday. Thank you for the tips. I did try -UseSsl but it returned with an error and I don't quite remember what it was currently.

spring sleet
#

Follow up, we ended up going a different route for our end goal. Apparently we have to have certain IP addresses "white listed" for relay. I was not aware of that which explains why it was failing.