Postfix + Dovecot + MySQL + Amazon SES

Hi guys,

I followed this guide at Linode to have a postfix + dovecot and mysql configuration

https://www.linode.com/docs/email/postf … -and-mysql">https://www.linode.com/docs/email/postfix/email-with-postfix-dovecot-and-mysql

It all worked.

But, I have this requirement where using the same setup. I need to send all postfix emails to Amazon SES. I am lost right now on how to combine Amazon SES with this setup, as some might conflict with the existing config.

Amazon SES

> relayhost = [email-smtp.us-west-2.amazonaws.com]:25

smtpsaslauth_enable = yes

smtpsaslsecurity_options = noanonymous

smtpsaslpasswordmaps = hash:/etc/postfix/saslpasswd

smtpusetls = yes

smtptlssecurity_level = encrypt

smtptlsnotestarttlsoffer = yes

postconf -n

> alias_database = hash:/etc/aliases

alias_maps = hash:/etc/aliases

appenddotmydomain = no

biff = no

config_directory = /etc/postfix

inet_interfaces = all

mailboxsizelimit = 0

mydestination = localhost

myhostname = mail.example.com

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

myorigin = /etc/mailname

readme_directory = no

recipient_delimiter = +

relayhost =

smtpdbanner = $myhostname ESMTP $mailname (Debian/GNU)

smtpdrecipientrestrictions = permitsaslauthenticated, permitmynetworks, rejectunauth_destination

smtpdsaslauth_enable = yes

smtpdsaslpath = private/auth

smtpdsasltype = dovecot

smtpdtlsauth_only = yes

smtpdtlscert_file = /etc/dovecot/dovecot.pem

smtpdtlskey_file = /etc/dovecot/private/dovecot.pem

smtpdusetls = yes

virtualaliasmaps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf

virtualmailboxdomains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf

virtualmailboxmaps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf

virtual_transport = lmtp:unix:private/dovecot-lmtp

dovecot -n

> # 2.1.7: /etc/dovecot/dovecot.conf

OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.8 ext4

auth_mechanisms = plain login

mail_location = maildir:/var/mail/vhosts/%d/%n

mailprivilegedgroup = mail

namespace inbox {

inbox = yes

location =

mailbox Drafts {

special_use = \Drafts

}

mailbox Junk {

special_use = \Junk

}

mailbox Sent {

special_use = \Sent

}

mailbox "Sent Messages" {

special_use = \Sent

}

mailbox Trash {

special_use = \Trash

}

prefix =

}

passdb {

args = /etc/dovecot/dovecot-sql.conf.ext

driver = sql

}

postmaster_address = postmaster@example.com

protocols = imap pop3 lmtp

service auth-worker {

user = vmail

}

service auth {

unix_listener /var/spool/postfix/private/auth {

group = postfix

mode = 0666

user = postfix

}

unix_listener auth-userdb {

mode = 0666

user = vmail

}

user = $defaultinternaluser

}

service imap-login {

inet_listener imap {

port = 0

}

}

service lmtp {

unix_listener /var/spool/postfix/private/dovecot-lmtp {

group = postfix

mode = 0666

user = postfix

}

}

service pop3-login {

inet_listener pop3 {

port = 0

}

}

ssl = required

sslcert = sslkey =
userdb {

args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n

driver = static

}

3 Replies

Looks like you are on the right track in setting up client SASL support to use a smarthost. You will also need to install the client SASL library; on Debian I think this is libsasl2-2.

Hi Vance,

I am assuming that /etc/postfix/main.cf is the only one that needs changing?

Will this work? if I am running already postfix, mysql, dovecot? I am thinking that it might affected authentication of mysql?

@LMX:

Hi Vance,

I am assuming that /etc/postfix/main.cf is the only one that needs changing?

Will this work? if I am running already postfix, mysql, dovecot? I am thinking that it might affected authentication of mysql?

I don't see why it would affect mysql.

smtp_* settings apply to outbound SMTP connections from your server.

smtpd_* settings apply to inbound connnections to your server.

For Amazon SES, you're adding a new set of smtp_* settings.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct