Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure msmtp with Amazon SES?

Amazon has instructions for postfix and sendmail, but not msmtp (simple SMTP client), so adding them here.

like image 645
Neil McGuigan Avatar asked May 26 '13 04:05

Neil McGuigan


People also ask

How do I enable SMTP on AWS?

Log into the AWS Management Console. In the SES tab, select SMTP Settings and click on Create a New SMTP User. Use the default User Name or edit this name and click Create. Copy your credentials or click on Download Credentials.


1 Answers

Install msmtp (ubuntu)

sudo apt-get install msmtp msmtp-mta

Configure it (sudo nano /etc/msmtprc):

defaults
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
syslog on

account default
host email-smtp.us-east-1.amazonaws.com
port 587
auth on
user YOUR_AMAZON_SES_SMTP_USERNAME
password YOUR_AMAZON_SES_SMTP_PASSWORD
from YOUR_AMAZON_SES_VERIFIED_SENDER

Use it. You don't need to set up PHP with the server info; the default configuration will pass messages to sendmail, and you're good to go.

<?php

mail("[email protected]", "some subject", "some message");

?>

If you don't use PHP, you can test on the command line:

$ sendmail [email protected]
Subject: test subject

This is a test message!
^D

(The ^D means type control-D to stop typing the message and send it.)

like image 66
Neil McGuigan Avatar answered Sep 28 '22 09:09

Neil McGuigan