Neil McGuigan
Neil McGuigan

Reputation: 48236

How to configure OpenSMTPD with Amazon SES?

Amazon has instructions for postfix and sendmail, but not OpenSMTPD, so adding them here.

Upvotes: 2

Views: 794

Answers (1)

Neil McGuigan
Neil McGuigan

Reputation: 48236

Tested with OpenBSD 5.8

  1. Verify your domain and a sender in AWS SES console. Save your SMTP Settings.

  2. Set up the SMTP authentication details in the mail secrets database (replacing $smtpUsername:$smtpPassword with the values from step 1)

    # touch /etc/mail/secrets
    # chmod 640 /etc/mail/secrets
    # chown root:_smtpd /etc/mail/secrets
    # echo "ses $smtpUsername:$smtpPassword" >> /etc/mail/secrets
    # makemap /etc/mail/secrets
    
  3. Configure OpenSMTPD:

    # nano /etc/mail/smtpd.conf
    
    listen on lo0
    table aliases db:/etc/mail/aliases.db
    table secrets db:/etc/mail/secrets.db
    accept for local alias <aliases> deliver to mbox
    accept from local for any relay via tls+auth://[email protected] auth <secrets>
    
  4. Restart OpenSMTPD:

    # rcctl restart smtpd
    
  5. Test it:

    # sendmail -v -f [email protected] [email protected]
    Subject: test subject
    
    test body
    ^D
    

Errors?

watch your line-breaks in smtpd.conf

# smtpd -n to check for syntax errors in smtpd.conf

Try port 587 if your machine is blocking port 25 (add :587 to end of aws url in smtpd.conf)

Upvotes: 3

Related Questions