We have failing SMTP requests because our port 25 was closed on our EC2 instances. These are the steps that you might want to follow in order to fix the SMTP issues and to be able to send email again.
You can look here for the docs that I followed to figure out the path forward.
- SSH into the lightsail instance
- Create a new file so that you can easily change text/spacing/etc
- The file content:
#!/bin/bash sudo postconf -e "relayhost = [email-smtp.us-east-1.amazonaws.com]:587" \ "smtp_sasl_auth_enable = yes" \ "smtp_sasl_security_options = noanonymous" \ "smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd" \ "smtp_use_tls = yes" \ "smtp_tls_security_level = encrypt" \ "smtp_tls_note_starttls_offer = yes"
- Edit the password:
sudo vim /etc/postfix/sasl_passwd
- Should look like this
[email-smtp.us-east-1.amazonaws.com]:587 SMTPUSERNAME:SMTPPASSWORD
- Create a new SMTP user on AWS or ask @Tim for the root
- Should look like this
- Hashmap the new creds
sudo postmap hash:/etc/postfix/sasl_passwd
- Change ownership and permissions
sudo chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
- Restart
postfix
:sudo service postfix restart
- Send a test email:
- You will enter the following line by line, pressing
enter
orcarriage return
after each - Be sure to replace
[email protected]
with whatever email you want to send the test to
sendmail -f [email protected] [email protected] From: Sender Name [email protected] Reply-To: [email protected] Subject: Amazon SES test mail test mail form ses. .
- Note: the last
.
is important. It tells the computer that you are done - NOTE: You might have to do
"Sender Name" <[email protected]>
in theFrom:
header. Try without and if that gives you5xx
errors in the log aboutSender@ip
andName@ip
not working, you will need to try the different format
- You will enter the following line by line, pressing