Skip to content

Instantly share code, notes, and snippets.

@gwire
Created November 18, 2016 10:31
Show Gist options
  • Save gwire/3449b58c5072eb402cf83cc6774ffa13 to your computer and use it in GitHub Desktop.
Save gwire/3449b58c5072eb402cf83cc6774ffa13 to your computer and use it in GitHub Desktop.
Exim config for working with Google delivery restrictions.
domainlist single_domain_mx = aspmx.l.google.com : gmail-smtp-in.l.google.com
dnslookup_single_domain:
debug_print = "R: dnslookup_single_domain for $local_part@$domain"
driver = dnslookup
domains = ! +local_domains : ! +relay_to_domains
condition = ${if forany{${lookup dnsdb{>: mxh=$domain}}}{match_domain{$item}{+single_domain_mx}}}
transport = remote_smtp_single_domain
same_domain_copy_routing = yes
no_more
remote_smtp_single_domain:
debug_print = "T: remote_smtp_single_domain for $local_part@$domain"
driver = smtp
multi_domain = false
max_rcpt = 8
.ifdef REMOTE_SMTP_HOSTS_AVOID_TLS
hosts_avoid_tls = REMOTE_SMTP_HOSTS_AVOID_TLS
.endif
.ifdef REMOTE_SMTP_HEADERS_REWRITE
headers_rewrite = REMOTE_SMTP_HEADERS_REWRITE
.endif
.ifdef REMOTE_SMTP_RETURN_PATH
return_path = REMOTE_SMTP_RETURN_PATH
.endif
.ifdef REMOTE_SMTP_HELO_DATA
helo_data=REMOTE_SMTP_HELO_DATA
.endif
.ifdef DKIM_DOMAIN
dkim_domain = DKIM_DOMAIN
.endif
.ifdef DKIM_SELECTOR
dkim_selector = DKIM_SELECTOR
.endif
.ifdef DKIM_PRIVATE_KEY
dkim_private_key = DKIM_PRIVATE_KEY
.endif
.ifdef DKIM_CANON
dkim_canon = DKIM_CANON
.endif
.ifdef DKIM_STRICT
dkim_strict = DKIM_STRICT
.endif
.ifdef DKIM_SIGN_HEADERS
dkim_sign_headers = DKIM_SIGN_HEADERS
.endif
.ifdef TLS_DH_MIN_BITS
tls_dh_min_bits = TLS_DH_MIN_BITS
.endif
.ifdef REMOTE_SMTP_TLS_CERTIFICATE
tls_certificate = REMOTE_SMTP_TLS_CERTIFICATE
.endif
.ifdef REMOTE_SMTP_PRIVATEKEY
tls_privatekey = REMOTE_SMTP_PRIVATEKEY
.endif
@gwire
Copy link
Author

gwire commented Nov 18, 2016

This is a minor update to a 2012 exim config for dealing with Google's multi-domain routing restrictions, with the addition of max_rcpt in order to avoid a "domain policy size" restriction which seems to kick-in if you attempt to deliver to more than eight recipients at a time. (Which mailing-list servers will tend to do.)

452-4.5.3 Domain policy size per transaction exceeded, please try this recipient in a separate transaction. unique.string - gsmtp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment