I am having an issue sending a test email from using Powershell for the purpose of testing the AWS SMTP Credentials I just generated through the SES Dashboard.
I have verified the domain of the from email address and also verified the from-email-address itself.
After generating the credentials from the smtp dashboard, I went to IAM and added extra permission to the credentials to look like this::
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ses:SendRawEmail",
"ses:SendEmail",
"ses:SendTemplatedEmail",
"ses:SendBulkTemplatedEmail",
"ses:*"
],
"Resource": "*"
}
]
}
Below is the Powershell command I am using to test the credential:
<# Source:
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp-client-command-line.html
#>
$EmailFrom = "verified-from-address"
$EmailTo = "gmail-recipient"
$Subject = "Hello from Amazon SES SMTP Test for Windows"
$Body = "This message was sent using the Amazon SES SMTP interface. There is no more content in this test email."
$SMTPServer = "email-smtp.eu-west-1.amazonaws.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("smtpusername", "smtppassword");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
Remove-Variable -Name SMTPClient
I replaced the smptp-username/smtp-password here with the actual smtp-credentials I downloaded from the credentials I created from the aws-ses-dashboard.
My SES account has also been upgraded to production, and I am able to send a test email from the SES-interface.
Here is the error I am seeing when I attempt to iniate the command from Powershell using the script above:
Exception calling "Send" with "4" argument(s): "Error in processing. The server response
was: 4.4.2 Timeout waiting for data from client."
At line:12 char:1
+ $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : SmtpException
Any help please?
I was expecting that the system would successfully send a test email ?
Samuelson Osoba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.