Using Win 10 1607, PSVersion 5.1.14393.1480 I am seriously confused. I want to send an email using Powershell via my Yahoo account. (I would have liked to send via my gmail account, but GMail rejects Powershell connections, unless I reduce the security on my account, which I am unwilling to do. Yahoo provides an "app password", supposedly for situations just like this).
So I generated an app password from my Yahoo account, and tried to send a test email like this: $Username = "[email protected]" $Password = "-Yahoo generated app password-" $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force $Credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $Username, $SecurePassword $RcptTo = "[email protected]" $Subject = "Yahoo Test" $Body = "This is a test message" Send-MailMessage -From $Username -To $RcptTo -Subject $Subject -Body $Body -SmtpServer smtp.mail.yahoo.com -Port 587 -UseSsl -Credential $Credentials And yet it still fails: Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication required At C:\Scripts\Send-Email-from-PS1.PS1:27 char:1 + Send-MailMessage -From $Username -To $RcptTo -Subject $Subject -Body ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpException + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage What am I missing here? How can I use Powershell to send email via Yahoo mail, preferably using their generated app password? Anyone doing this? How are you sending email from Powershell?

