Can I use TLS with Send-MailMessage cmdlet?

Question:

I am trying to send an email using PowerShell, but need to use TLS. Any way I can do that using Send-MailMessage cmdlet?

This is my code:

Thanks a lot!

Answer:

Make sure your specify the -UseSsl switch:


If the SMTP server uses a specific port for SMTP over TLS, use the -Port parameter:

If you want to make sure that TLS is always negotiated (and not SSL 3.0), set the SecurityProtocol property on the ServicePointManager class:

Source:

Can I use TLS with Send-MailMessage cmdlet? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply