Skip to content

Instantly share code, notes, and snippets.

@codeck
Last active February 16, 2023 19:05
Show Gist options
  • Save codeck/c68fe7b322a4020d2ff1 to your computer and use it in GitHub Desktop.
Save codeck/c68fe7b322a4020d2ff1 to your computer and use it in GitHub Desktop.
poorman's enterprise mail server
(mainly quoted from http://n3mesisfixx.blogspot.com/2013/07/configuring-exim4-to-route-to-many.html)
0. manage domain "enterprisedomain.com" and mx record and PTR/ip reverse name
1. install debian
2. setup exim4 domains
run $dpkg-reconfigure exim4-config'
set "type" as internet
set "mail name" to *somelocalname* eg. debian or change /etc/mailname+/etc/hosts
set "other dest domain"/dc_other_hostnames as "*somelocalname*; enterprisedomain.com;", make sure *somelocalname* in the list.
3. enable virtual alias
edit /etc/exim4/exim4.conf.template, add:
#####################################################
# router/350_exim4-config_virtual_aliases
#####################################################
#---------------------------
# This router is added so that we can use this server for multiple domains
# And also be able to define custom aliases for each of these domains...
# NOTE : this router is placed before the system_aliases router so that virtual domain
# routing takes precedence over system_aliases
#----------------------------
#allows for aliases of the sort==> [email protected] : local_user, [email protected]
domains_virtual:
driver = redirect
data = ${lookup{$local_part@$domain}lsearch{/etc/exim4/aliases.virtual}}
#allows for a special catch-all alias of the sort==> @host.com : local_user, [email protected]
domains_virtual_others:
driver = redirect
data = ${lookup{@$domain}lsearch{/etc/exim4/aliases.virtual}}
#####################################################
# end router/350_exim4-config_virtual_aliases
#####################################################
between 300 and 400, as https://gist.github.com/mcnemesis/5928364#file-350_exim4-config_virtual_aliases and
4. setup alias
edit /etc/exim4/aliases.virtual as lines of "*@enterprisedomain.com: somelocaluser"
5. set correct from field from to field when reply
edit ~somelocaluser/.muttrc, add:
alternates ^[email protected]$ ^[email protected]$ ^[email protected]$
set reverse_name=yes
(http://dev.mutt.org/trac/wiki/UseCases/MultiAccounts)
6. override return path to postmaster
edit /etc/exim4/exim4.conf.template, check MAIN_FORCE_SENDER not enabled or add somelocaluser as trusted user:
trusted_users = MAIN_TRUSTED_USERS : somelocaluser
edit ~somelocaluser/.muttrc, add:
set use_envelope_from
set envelope_from_address="[email protected]"
7. stripe local delivery transport header
edit /etc/exim4/exim4.conf.template, in remote_smtp section, add:
headers_remove = Received
or:
received_header_text = ""
@codeck
Copy link
Author

codeck commented Apr 1, 2015

Mesage-ID should not be removed from header, otherwise will be regarded as spam.
http://www.google.com/mail/help/bulk_mail.html

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