Adding custom headers to exim4

968 views Asked by At

Im trying to add custom headers to my Exim4 config for all my emails to show up in CloudWatch. To get it working i updated the config with below:

.ifdef DCconfig_smarthost DCconfig_satellite
# configtype=smarthost or configtype=satellite
#
# Send all non-local mail to a single other machine (smarthost).
#
# This means _ALL_ non-local mail goes to the smarthost. This will most
# probably not do what you want for domains that are listed in
# relay_domains. The most typical use for relay_domains is to control
# relaying for incoming e-mail on secondary MX hosts. In that case,
# it doesn't make sense to send the mail to the smarthost since the
# smarthost will probably send the message right back here, causing a
# loop.
#
# If you want to use a smarthost while being secondary MX for some
# domains, you'll need to copy the dnslookup_relay_to_domains router
# here so that mail to relay_domains is handled separately.

smarthost:
  debug_print = "R: smarthost for $local_part@$domain"
  driver = manualroute
  headers_add = X-SES-CONFIGURATION-SET: CloudWatch
  headers_add = X-SES-MESSAGE-TAGS: customer=senet, application=twentyfour
  domains = ! +local_domains
  transport = remote_smtp_smarthost
  route_list = * DCsmarthost byname
  host_find_failed = ignore
  same_domain_copy_routing = yes
  no_more

.endif

This actually works well where i updated the debug message on the router and while sending emails from the CLI that specific message was shown.

When i check the exim config exim -bP config i see that also there the info is set properly:

begin routers

  smarthost:
    debug_print = "R: smarthost for $local_part@$domain"
    driver = manualroute
    headers_add = X-SES-CONFIGURATION-SET: CloudWatch
    headers_add = X-SES-MESSAGE-TAGS: customer=senet, application=twentyfour
    domains = ! +local_domains
    transport = remote_smtp_smarthost
    route_list = * email-smtp.eu-central-1.amazonaws.com:587 byname
    host_find_failed = ignore
    same_domain_copy_routing = yes
    no_more
    COND_LOCAL_SUBMITTER = "${if match_ip{$sender_host_address}{:@[]}{1}{0}}"

The only problem is that i don't see any of these 2 headers in my actual email.

Thanks in advance,

Best, Pim

0

There are 0 answers