Amazon has instructions for postfix and sendmail, but not msmtp (simple SMTP client), so adding them here.
Asked
Active
Viewed 3,300 times
1 Answers
11
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("user@example.com", "some subject", "some message");
?>
If you don't use PHP, you can test on the command line:
$ sendmail test-recipient@example.com
Subject: test subject
This is a test message!
^D
(The ^D
means type control-D to stop typing the message and send it.)

benzado
- 82,288
- 22
- 110
- 138

Neil McGuigan
- 46,580
- 12
- 123
- 152
-
1With Amazon SES, don't forget to verify the sender domain (http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-addresses-and-domains.html) and enable production SES mode, or you won't be able to send to arbitrary addrs. – GaryO Jul 02 '14 at 21:11
-
2If you enable `logfile`, then sending mail will fail if the current user doesn't have write access to the log file. It's better to use `syslog on` instead, so that the log messages can be routed by syslog from any user, to wherever you please. – benzado Jun 16 '15 at 15:35