-
-
Save jorke/6879224 to your computer and use it in GitHub Desktop.
Send-MailMessage -From <from> -to <to> -subject <subject> -SmtpServer email-smtp.us-east-1.amazonaws.com -Credential | |
$(New-Object System.Management.Automation.PSCredential -argumentlist <AWS_ACCESS_KEY>, | |
$(ConvertTo-SecureString -AsPlainText -String <AWS_SECRET_KEY> -Force) | |
) | |
-UseSsl -Port 587 |
I had a little trouble with above syntax, this worked for me
$AWS_ACCESS_KEY = "************"
$AWS_SECRET_KEY = "************"
$SECURE_KEY = $(ConvertTo-SecureString -AsPlainText -String $AWS_SECRET_KEY -Force)
$creds = $(New-Object System.Management.Automation.PSCredential ($AWS_ACCESS_KEY, $SECURE_KEY))
$from = "[email protected]"
$to = "[email protected]"
$subject = "test"
$body = "This is the body"
Write-Host "Sending Email via AmazonSES"
Send-MailMessage -From $from -To $to -Subject $subject -Body $body -SmtpServer email-smtp.us-east-1.amazonaws.com -Credential $creds -UseSsl -Port 587
Write-Host "Sent"
Friends :-
Here is the error I am getting.
Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server
response was: Authentication required.
Are there means of debugging further.
The command works perfectly, I have just utilised it in a project I am working on.
If you get issues, try and put the whole command string on one line, and see whether that works for you...
@DanielAdeniji create the SMTP credentials (access/secret key) from the SES console (instead of IAM). https://docs.aws.amazon.com/ses/latest/dg/smtp-credentials.html
Friends :-
Here is the error I am getting.
Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server
response was: Authentication required.
Are there means of debugging further.
@DanielAdeniji hello do you find solution for that ? i have same error
@misterersonn Same thing here
People having the secure connection/authentication error need to check they are using the correct SMTP server
Thanks for taking the time to share this!
Helped me out no end :-)