Abilitare il relay su exim4 per i domini è relativamente semplice.
Ma c’è la possibilità di dire al server di usare mandrill solo per domini specifici.

Vediamo come procedere:

Dopo aver installato VestaCP, e sufficiente editare il file exim4.conf.template con

pico /etc/exim4/exim4.conf.template

e aggiungere subito dopo begin authenticators
mandrill_login:
driver = plaintext
public_name = LOGIN
client_send = : USERNAME_MANDRILL : APIKEY-MANDRILL

dopo begin routers
send_to_mandrill:
condition = ${lookup {${domain:$h_from:}} lsearch{/etc/mandrilldomains}}
driver = manualroute
ignore_target_hosts = 127.0.0.0/8
transport = mandrill_smtp
route_list = * smtp.mandrillapp.com

mentre dopo begin transports
mandrill_smtp:
driver = smtp
port = 587
hosts_require_auth = $host_address
hosts_require_tls = $host_address

ora creiamo il file mandrilldomains
pico /etc/mandrilldomains
e inseriamo i nostri domini nel seguente formato
domain.tld: ok
domain2.tld: ok
domain3.tld: ok
domain4.tld: ok

Bene ora non ci resta che riavviare e fare qualche prova
service exim4 restart

Risorsa: http://www.tgunkel.de/docs/exim_smarthosts.en

Define Smarthost

  1. The simplest variation is to deliver mails directly. The achieve this write this entry in your “ROUTERS CONFIGURATION” section:
    # direct delivery
    smarthost_directly:
      debug_print = "R: dnslookup for $local_part@$domain"
      driver = dnslookup
      domains = ! +local_domains
      transport = remote_smtp
      #same_domain_copy_routing = yes
      #ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.168.0.0/16 : 172.16.0.0/12 : 10.0.0.0/8 : 169.254.0.0/16
      no_more
  2. Alternative you may define a smarthost that delivers all your mail. If your provider’s smarthost is called mail.example.com use this entry:
    FIXME

    smarthost:
       driver = domainlist
       transport = remote_smtp
       route_list = "* mail.example.com bydns_a"
  3. Some smarthosts only accept their own addresses. This is how you distribute your mails to different smarthosts according to their sender-domain:
    FIXME

    smarthost_alpha:
       condition = ${if eq {${lc:$sender_address_domain}} {example.com} {true} fail }
       driver = domainlist
       transport = remote_smtp
       route_list = "* mail.example.com bydns_a"
    
    smarthost_beta:
       condition = ${if eq {${lc:$sender_address_domain}} {example.org} {true} fail }
       driver = domainlist
       transport = remote_smtp
       route_list = "* smtp.example.org bydns_a"
    
    ...
  4. You may even have a different smarthosts for each sender-address:
    FIXME

    smarthost_alpha:
       condition = ${if eq {${lc:$sender_address}} {usera@example.com} {true} fail }
       driver = domainlist
       transport = remote_smtp
       route_list = "* mail.example.com bydns_a"
    
    smarthost_beta:
       condition = ${if eq {${lc:$sender_address}} {userb@example.com} {true} fail }
       driver = domainlist
       transport = remote_smtp
       route_list = "* mail.example.com bydns_a"
    
    ...
  5. If you use the configuration file I presented at the beginning of this page use this to let exim automatically decide if and which smarthost to use:
    smarthost_auto:
       condition = ${extract{smart_host}{${lookup{$sender_address}lsearch{/etc/exim/smtp_users}{$value}fail}}}
       driver = manualroute
       domains = ! +local_domains
       route_list = "* ${extract{smart_host}{${lookup{$sender_address}lsearch{/etc/exim/smtp_users}{$value}fail}}} bydns_a"
       transport = remote_smtp
    # direct delivery
    smarthost_directly:
      debug_print = "R: dnslookup for $local_part@$domain"
      driver = dnslookup
      domains = ! +local_domains
      transport = remote_smtp
      #same_domain_copy_routing = yes
      #ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.168.0.0/16 : 172.16.0.0/12 : 10.0.0.0/8 : 169.254.0.0/16
      no_more