I am using the send-MailMessage
cmdlet in PowerShell version 2 and it gives me a error.
I tried using all the options which were mentioned in the earlier posts and it didn't help me.
This is the command that I am using:
send-MailMessage -from "[email protected]" -to "[email protected]"
-subject "test" -body"test" -smtp "smtp.gmail.com"
I get an error:
Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated
e was: 5.7.0 Must issue a STARTTLS command first. l46sm12283804qgd.27 - gsmtp
At line:1 char:17
+ send-MailMessage <<<< -from "[email protected]" -to "[email protected]" -subject "te
credential abc
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Se
ion
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
I tried using UseSsl= true
and also by giving credentials and even then I was not able to send email. Could you let me know what I am missing here?