Showing posts with label exim4. Show all posts
Showing posts with label exim4. Show all posts

Friday, 12 February 2016

Configuring exim4 for AWS/Amazon/SES


Exim4 and AWS SES


So if you want to use Amazon SES to send out emails, you'll need to verify your email address under Identity management -> Email addresses, which should send you an email to verify you own the recipient address.

Create SES credentials 

Under Email settings -> SMTP settings.
Don't forget them!

Configure Exim


 dpkg-reconfigure exim4-config
 
  • mail sent by smarthost, received via SMTP or fetchmail
  • your fully qualified domain name (e.g. example.com)
  • 127.0.0.1   for listen address
  • your fully qualified domain name (e.g. example.com) for final destination
  • no relay servers
  • your AWS SES smtp server as outgoing smarthost.  Importantly, don’t use the default port of 25, as 25 is unencrypted, and exim4 won’t send passwords over unencrypted connections without messing around.  So, for example, you might have “email-smtp.us-east-1.amazonaws.com::587”
  • Accept defaults for everything else

Create a file /etc/exim4/passwd.client.  This will give exim4 the logon credentials.  Importantly, amazon will resolve to a different server name each time (via the load balancer), so you can’t just put your smtp server name in here.  Your format should be something like:

# password file used when the local exim is authenticating to a remote
# host as a client.
#
# see exim4_passwd_client(5) for more documentation
#
# Example:
### target.mail.server.example:login:password
*.amazonaws.com:<smtp_username>:<smtp_password>
 
Also check your aliases file in /etc/aliases

Saturday, 30 August 2014

Using google mail servers as a smarthost from a linux server (ubuntu)

So you want to send mail securely using google's mail servers as a smarthost.

The first thing you'll need is an application specific password for exim.

Once that's created, I will assume the following:
  • You are ok with Gmail rewriting your sender address or use this Gmail address.
  • Your account name on your local Debian box: YOUR-USER-NAME
  • Your host name in /etc/hostname: hostname1
  • Your host name in the 127.0.1.1 line of /etc/hosts: hostname1.localdomain hostname1
  • Your envelope address is SMTPAccountName@gmail.com for the outgoing SMTP connection to Gmail's SMTP server via Exim4
  • Your Exim4 relays local SMTP connections coming with the mail envelope address: YOUR-USER-NAME@localhost and YOUR-USER-NAME@localhost.localdomain
  • Your account name for SMTP at Gmail is SMTPAccountName@gmail.com
  • Your password for SMTP at Gmail is y0uRpaSsw0RD
     
# dpkg-reconfigure exim4-config
 
  • Choose "mail sent by smarthost; received via SMTP or fetchmail"
  • Set to "localhost" for "System mail name:".
  • Set to "127.0.0.1" for "IP-addresses to listen on for incoming SMTP connections" to refuse external connections.
  • Leave as empty for "Other destinations for which mail is accepted:".
  • Leave as empty for "Machines to relay mail for:".
  • Set to "smtp.gmail.com::587" for "IP address or host name of the outgoing smarthost:".
  • Choose "NO" for "Hide local mail name in outgoing mail?".
  • Choose "NO" for "Keep number of DNS-queries minimal (Dial-on-Demand)?".
  • Choose "mbox format in /var/mail/" for "Delivery method for local mail".
  • Choose "YES" for "Split configuration into small files?".
vi /etc/exim4/passwd.client
 
 
add the following lines:
*.google.com:SMTPAccountName@gmail.com:y0uRpaSsw0RD
# chown root:Debian-exim /etc/exim4/passwd.client # chmod 640 /etc/exim4/passwd.client
 
Edit your aliases file
# newaliases
 
# update-exim4.conf
# invoke-rc.d exim4 restart
# exim4 -qff
 
 tada
 
mostly grepped from here