AWS SES with exim4 on debian-based Linux



  1. apt-get install exim4
  2. dpkg-reconfigure exim4-config
    1. Select: internet site; mail is sent and received directly using SMTP
    2. IP-addresses to listen on for incoming SMTP connections:
      1. 127.0.0.1 ; ::1 (it's the default anyways)
    3. Take most defaults
    4. Split configuration into small files?
      1. NO!
  3. lsof -nP -i :25
    1. Make sure you aren't allowing the world to connect!
      1. 127.0.0.1:25 is good
  4. AWS -> SES
    1. Verified Senders
      1. Verify one of your existing email addresses
    2. SMTP Settings
      1. Create My SMTP Credentials
      2. Use downloaded credentials.csv file contents for below steps
  5. Edit /etc/exim4/exim4.conf.template
    1. Find ALREADY existing line "public_name = LOGIN"
      1. change to "public_name = OLD_LOGIN"
    2. Add below sections to existing sections in the file
    3. Use info from credentials.csv in place of pointy brackets, e.g. <aws_id> 
  6. service exim4 stop
  7. service exim4 start
  8. tail -F /var/log/exim4/mainlog
    1. Keep this running in another terminal while you do the below
  9. echo test001 | mail -r <email_you_verified_with_aws> -s "Test subject" <a_test_email_address>
    1. e.g. echo test001 | mail -r bob@myawsverified.com -s test bob@testaccount.com
  10. See this to set the "From:" field to your verified user for every email sent from your system
    1. http://sysadminandnetworking.blogspot.com/2013/02/exim-rewrite-from-field.html


begin routers

send_via_ses:
  driver = manualroute
  domains = ! +local_domains
  transport = ses_smtp
  route_list = * email-smtp.us-east-1.amazonaws.com


begin transports

ses_smtp:
  driver = smtp
  port = 25
  hosts_require_auth = $host_address
  hosts_require_tls = $host_address


begin authenticators

ses_login:
  driver = plaintext
  public_name = LOGIN
  client_send = : <aws_id> : <aws_secret>

Comments

Popular posts from this blog

Openvpn and unbound combined break dig command

Stress Linux system: stress-ng

Google Nexus 4: permanent back panel glass repair for less than a penny