Neil McGuigan
Neil McGuigan

Reputation: 48236

How to configure msmtp with Amazon SES?

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

Upvotes: 8

Views: 3764

Answers (1)

Neil McGuigan
Neil McGuigan

Reputation: 48236

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.)

Upvotes: 11

Related Questions