🚀 DevOps & SRE Certification Program 📅 Starting: 1st of Every Month 🤝 +91 8409492687 🔍 Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Bash/Shell Script to test SMTP SES Credentials

Requirement

$ sudo yum install mailx 
$ sudo apt-get install mailutils 
#!/bin/bash
# Set the SMTP server name and port number
SMTP_SERVER="email-smtp.ap-south-1.amazonaws.com"
SMTP_PORT="587"
# Set the sender email address and AWS SES username and password
SENDER_EMAIL="contact@XXXXXXXX.com"
SES_USERNAME="XXXXXXXXXXX"
SES_PASSWORD="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# Set the recipient email address
RECIPIENT_EMAIL="XXXXXX@XXXXXXXX.com"
# Test SMTP credentials using openssl and telnet
echo "Testing SMTP credentials..."
openssl s_client -connect $SMTP_SERVER:$SMTP_PORT -starttls smtp -crlf <<< "EHLO $SMTP_SERVER" > /dev/null
echo "HELO $SMTP_SERVER" | openssl s_client -starttls smtp -connect $SMTP_SERVER:$SMTP_PORT -crlf -quiet -ign_eof 2>&1 > /dev/null
echo "QUIT" | openssl s_client -starttls smtp -connect $SMTP_SERVER:$SMTP_PORT -crlf -quiet -ign_eof 2>&1 > /dev/null
# Send a test email using telnet
echo "Sending a test email..."
{
sleep 1
echo "EHLO $SMTP_SERVER"
sleep 1
echo "AUTH LOGIN"
sleep 1
echo -n "$SES_USERNAME" | base64
sleep 1
echo -n "$SES_PASSWORD" | base64
sleep 1
echo "MAIL FROM: <$SENDER_EMAIL>"
sleep 1
echo "RCPT TO: <$RECIPIENT_EMAIL>"
sleep 1
echo "DATA"
sleep 1
echo "Subject: Test Email"
echo "From: $SENDER_EMAIL"
echo "To: $RECIPIENT_EMAIL"
echo "This is a test email."
echo "."
sleep 1
echo "QUIT"
} | openssl s_client -starttls smtp -connect $SMTP_SERVER:$SMTP_PORT -crlf -quiet -ign_eof 2>&1 > /dev/null
echo "Test complete."
#!/bin/bash
# Set the SMTP server name and port number
SMTP_SERVER="email-smtp.us-east-1.amazonaws.com"
SMTP_PORT="587"
# Set the sender email address and AWS SES username and password
SENDER_EMAIL="your-sender-email@example.com"
SES_USERNAME="AWS-SES-USERNAME"
SES_PASSWORD="AWS-SES-PASSWORD"
# Set the recipient email address
RECIPIENT_EMAIL="recipient-email@example.com"
# Test SMTP credentials using openssl and mailx
echo "Testing SMTP credentials..."
openssl s_client -connect $SMTP_SERVER:$SMTP_PORT -starttls smtp -crlf <<< "EHLO $SMTP_SERVER" > /dev/null
echo "HELO $SMTP_SERVER" | openssl s_client -starttls smtp -connect $SMTP_SERVER:$SMTP_PORT -crlf -quiet -ign_eof 2>&1 > /dev/null
# Send a test email using mailx
echo "Sending a test email..."
echo "This is a test email" | mailx -v -r $SENDER_EMAIL -s "Test Email" -S smtp="$SMTP_SERVER:$SMTP_PORT" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="$SES_USERNAME" -S smtp-auth-password="$SES_PASSWORD" $RECIPIENT_EMAIL
echo "Test complete."
Subscribe
Notify of
guest


0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x