This is my first post so we will see how it goes!!!
I am having trouble getting PowerShell sending a test email to my Yahoo email account.
I am using the correct entries for my email account, password, and smtp server.
I either get the script containing my code to go through with no errors, or I get a “Failure Sending Mail” error message.
Can anyone provide and iron clad script that will deliver a simple test message to my Yahoo email account?
PS I have already read the Microsoft KB articles on this subject but to no avail. I tend to think this is less of a PowerShell problem and some other issue on my local computer. I have also tried my Gmail account with the same results.
How should we know what’s wrong when we don’t know what you tried? Please show your code (format it as code using the code tag button on the editor windows).
Thanks
If you get error messages you should post these as well (formatted as code as well). A lot of times there’s already a hint or even the solution for the error inside the error message.
hmmm … nowadays you secure your mail accounts or accounts in general a lot of times with a two factor authentication. Did you do that for your Yahoo account? (at least I did ) … if you did so you should create a so called “App - Password” to be used with apps not able to use Yahoo’s login with 2FA. I just tested it and it works just as expected …
$Params = @{
From = ‘MailAlias@yahoo.com’
To = ‘MailAlias@yahoo.com’
Subject = ‘Test’
Body = ‘Email for Overnight Error Notification’
SmtpServer = ‘smtp.mail.yahoo.com’
UseSsl = $true
Credential = New-Object System.Management.Automation.PSCredential -ArgumentList ‘MailAlias@yahoo.com’, $(‘SuperRandomAppPassword’ | ConvertTo-SecureString -AsPlainText -Force)
}
can you walk me through checking for 2 factor authentication as well as setting up the “App Password” you talked about so that I can get this script working please?