- Newest
- Most votes
- Most comments
Hello.
I thought your shell script would also work based on the samples provided in the documentation below.
Just to be sure, please try the sample shell script provided in the document below to see if it works.
https://docs.aws.amazon.com/ses/latest/dg/send-email-smtp-client-command-line.html#send-email-using-openssl
By the way, are there any error messages output when you run your shell script?
Also, check if the SMTP endpoint is correct and the SMTP user credentials are correct.
Hello, The issue is likely due to a missing blank line between the "DATA" command and the email body, and another blank line between the email body and the "QUIT" command. Add these blank lines to properly format the email.
bash
#!/bin/bash
SMTPUsername="AKIAXEU5JZXLU7VMPURD"
SMTPPassword="xxxxxx"
MAILFROM="kevinszhang@yahoo.com"
RCPT="kevinszhang@yahoo.com"
SUBJECT='aws'
DATA="This is a test message from aws."
CONFIGSET="my-first-configuration-set"
EncodedSMTPUsername=$(echo -n "$SMTPUsername" | openssl enc -base64)
EncodedSMTPPassword=$(echo -n "$SMTPPassword" | openssl enc -base64)
Email="
EHLO (link unavailable)
AUTH LOGIN $EncodedSMTPUsername $EncodedSMTPPassword
MAIL FROM: $MAILFROM
RCPT TO: $RCPT
DATA
X-SES-CONFIGURATION-SET: $CONFIGSET
From: $MAILFROM
To: $RCPT
Subject: $SUBJECT
MIME-Version: 1.0
Content-Type: text/plain
$DATA
.
QUIT
"
echo "$Email" | openssl s_client -crlf -quiet -connect (link unavailable)
if [ $? -eq 0 ]; then
echo "success"
exit 0
else
echo "failed"
exit 1
fi
The script was missing blank lines between the "DATA" command and the email body, and between the email body and the "QUIT" command. Adding these blank lines should resolve the issue.
I did as you suggested but still not working.
The following is the output:
X-SES-CONFIGURATION-SET: my-first-configuration-set depth=2 C = US, O = Amazon, CN = Amazon Root CA 1 verify return:1 depth=1 C = US, O = Amazon, CN = Amazon RSA 2048 M01 verify return:1 depth=0 CN = email-smtp.us-west-1.amazonaws.com verify return:1 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-d-ECHQAJO17 WGfBBnsLmMzFMqUTe62y 250-email-smtp.amazonaws.com 250-8BITMIME 250-AUTH PLAIN LOGIN 250 Ok 334 VXNlcm5hbWU6 334 UGFzc3dvcmQ6 235 Authentication successful. 250 Ok 250 Ok 354 End data with <CR><LF>.<CR><LF> 250 Ok 01110191374bfd71-e5b9befc-e03e-4ea0-85c2-2010ea59ad3f-000000 451 4.4.2 Timeout waiting for data from client. success
yahoo.com has a "reject" DMARC policy, so you cannot send from SES using that domain because you are not authorized to verify the yahoo.com domain, as a user of Yahoo Mail
Enable VDM to see when messages bounce, and why. Otherwise, you may subscribe to the event stream and process the bounce events as best fits your architecture
Relevant content
- asked 2 years ago
The script I am using is based on the URL you suggested.
Thank you for sharing your message. Judging from the message, I think the email was sent normally. Please check to see if it has been sent to your spam folder. https://docs.aws.amazon.com/ses/latest/dg/troubleshoot-smtp.html
Yahoo mail and Gmail have strict security, so it is possible that they are blocked. https://aws.amazon.com/jp/blogs/messaging-and-targeting/an-overview-of-bulk-sender-changes-at-yahoo-gmail/
I checked the trash but no email. Email bounced said failure to deliver it. I got the 250 Ok but then 451 timed out:
Is it possible for you to send the message to me using the script I provide?
250 Ok 250 Ok 354 End data with <CR><LF>.<CR><LF>
250 Ok 01110191374bfd71-e5b9befc-e03e-4ea0-85c2-2010ea59ad3f-000000 451 4.4.2 Timeout waiting for data from client.
Thanks again for your clues. The issue is: how am I going to prevent the blocking of gmail/yahoo? Because I checked DNS setting already. Not sure what to do next.