unable to send email from powershell script

Varshini S
Varshini S used Ask the Experts™
on
$users = "test@live.com" # Users to be notified
 
$fromemail = "test@live.com" # From Email
 
$server = "smtp.live.com" #SMTP Server information

------------
--------
send-mailmessage -from $fromemail -to $users -subject "CPU Utilization Monitoring Alert" -BodyAsHTML -body $HTMLmessage -priority High -smtpServer $server

I am getting below exception:


send-mailmessage : The SMTP server requires a secure connection or the client was not authenticated. The server
response was: 5.7.0 Must issue a STARTTLS command first
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
PowerShell Developer
Top Expert 2010
Commented:
The error message is quite clear about the reason. Try adding "-UseSSL".

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial