Edit Exim Configuration (CLI Command Line Option)
The preferred way to apply the necessary config is to create /etc/exim.conf.local, and paste in the following:
%RETRYBLOCK% +secondarymx * F,4h,5m; G,16h,1h,1.5; F,4d,8h * * F,2h,15m; G,16h,1h,1.5; F,4d,8h @AUTH@ outboundemailfilter_login: driver = plaintext public_name = LOGIN client_send = : YourUsername : YourPassword @BEGINACL@ @CONFIG@ @DIRECTOREND@ @DIRECTORMIDDLE@ @DIRECTORSTART@ @ENDACL@ @POSTMAILCOUNT@ @PREDOTFORWARD@ @PREFILTER@ @PRELOCALUSER@ @PRENOALIASDISCARD@ @PREROUTERS@ @PREVALIASNOSTAR@ @PREVALIASSTAR@ @PREVIRTUALUSER@ @RETRYEND@ @RETRYSTART@ @REWRITE@ @ROUTEREND@ @ROUTERMIDDLE@ @ROUTERSTART@ send_to_outboundemailfilter: driver = manualroute domains = ! +local_domains transport = outbound.ouemfi.com hosts_randomize = true route_list = * outbound.ouemfi.com::25 randomize byname host_find_failed = defer no_more @TRANSPORTEND@ @TRANSPORTMIDDLE@ @TRANSPORTSTART@ outbound.ouemfi.com: driver = smtp hosts_require_auth = * tls_tempfail_tryclear = true headers_add = X-AuthUser: ${if match {$authenticated_id}{.*@.*}\ {$authenticated_id} {${if match {$authenticated_id}{.+}\ {$authenticated_id@$primary_hostname}{$authenticated_id}}}}
Save and exit /etc/exim.conf.local
There is an example configuration file attached to this KB article.
Edit Exim Configuration (GUI Option)
The configuration above can be replicated via the CPanel GUI.
- In CPanel, navigate to Service Configuration -> Exim Configuration Manager.
- Click on the Advanced tab, and scroll down about halfway, to "Section: AUTH" (You can search in the page to help find it)
- Add the following to Section: AUTH, replacing
YourUsername
andYourPassword
with those provided to you:
outboundemailfilter_login: driver = plaintext public_name = LOGIN client_send = : YourUsername : YourPassword
Scroll to Section: ROUTERSTART, and paste in the following:
send_to_outboundemailfilter: driver = manualroute domains = ! +local_domains transport = outbound.ouemfi.com hosts_randomize = true route_list = * outbound.ouemfi.com::25 randomize byname host_find_failed = defer no_more
Scroll to Section: TRANSPORTSTART, and paste in the following:
outbound.ouemfi.com: driver = smtp hosts_require_auth = * tls_tempfail_tryclear = true headers_add = X-AuthUser: ${if match {$authenticated_id}{.*@.*}\ {$authenticated_id} {${if match {$authenticated_id}{.+}\ {$authenticated_id@$primary_hostname}{$authenticated_id}}}}
Scroll to the bottom, and click Save
Setup for mailman lists
If you use mailman lists in CPanel, you'll need to manually edit /etc/exim.conf
. Find a section which looks something like this (may vary in different version of CPanel):
mailman_virtual_transport: driver = pipe command = /usr/local/cpanel/3rdparty/mailman/mail/mailman \ '${if def:local_part_suffix \ {${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \ {post}}' \ ${lc:$local_part}_${lc:$domain} current_directory = /usr/local/cpanel/3rdparty/mailman home_directory = /usr/local/cpanel/3rdparty/mailman user = mailman group = mailman
And add the following directly after "group = mailman":
headers_add = "X-MC-MailingList:$original_local_part@$original_domain\n"
The resulting config will look like this:
mailman_virtual_transport: driver = pipe command = /usr/local/cpanel/3rdparty/mailman/mail/mailman \ '${if def:local_part_suffix \ {${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \ {post}}' \ ${lc:$local_part}_${lc:$domain} current_directory = /usr/local/cpanel/3rdparty/mailman home_directory = /usr/local/cpanel/3rdparty/mailman user = mailman group = mailman headers_add = "X-MC-MailingList:$original_local_part@$original_domain\n"
Save and exit /etc/exim.conf
.
Restart exim
Run systemctl restart exim
to restart exim (assuming CentOS7 is the base OS for CPanel)
Send test email
From the command line, you can send a test email to yourself, by running the following (replacing <your-email-address>
with a real one):
echo "Hello, I am your test" | mail -r <your-email-address> -s "Test email via outboundemailfilter.com" <your-email-address>
Check the contents of /var/log/exim_mainlog
to confirm successful delivery
Here's an example of what a successful email delivery might look like:
2019-03-23 00:23:02 1h7URA-0001LA-Bg => test@example.com R=smarthost T=remote_smtp_smarthost H=outbound.ouemfi.com [54.69.62.154] X=TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256 CV=no DN="CN=example.com,C=AU,ST=Some-State,O=Internet Widgits Pty Ltd" A=plain C="250 2.0.0 Ok: queued as d1b94395-4d01-11e9-9a10-d1cb19a74d67" 2019-03-23 00:23:02 1h7URA-0001LA-Bg Completed