2

I'm trying to configure exim to relay mails via an Office 365 account. I can find quite a few examples of doing this via postfix but almost none on exim.

Is this at all possible? The idea is to have an exim installation on our LAN to which printers, fax machines, switches and other misc. applications can connect to and upload mails. Exim will then relay these mails through a pre-defined O365 account.

Thank you,
m^e

3
  • This certainly can be done. What distribution are you using? Must all mail going through this server be relayed to the Office 365 system? – wurtel Oct 7 '15 at 13:52
  • Thanks for your reply. Yes - all mails from this will go through O365 as that's our mail service provider. Majority of these peripheral devices cannot authenticate directly with an O365 mailbox... hence this attempt to relay through exim. – miCRoSCoPiCeaRthLinG Oct 8 '15 at 14:16
  • Forgot to mention the Distro. It's CentOS 7 x64. – miCRoSCoPiCeaRthLinG Oct 8 '15 at 15:04
1

You need a smarthost_auth router (you can make up any name for this), in the routers section (i.e. what begins with begin routers); order is important and seeing how all mail should be sent to the O365 server, put it at the top of the routers:

smarthost_auth:
  debug_print = "R: smarthost for $local_part@$domain"
  driver = manualroute
  domains = ! +local_domains
  transport = smtp_smarthost_auth
  route_list = * o365server.example.com byname
  host_find_failed = defer
  same_domain_copy_routing = yes
  no_more

You can replace the domains line with domains = * if all mail must go to the O365 server; put the right hostname for that server in the route_list line.

Then you need this transport (again I chose the name, change it if you want); put this in the section beginning with begin transports, order is not important:

smtp_smarthost_auth:
  debug_print = "T: remote_smtp_smarthost for $local_part@$domain"
  driver = smtp
  hosts_require_auth = *

Finally you need an appropriate authenticator, after the line begin authenticators. Presumably the config you have already has a cram_md5, plain and login stanza there. E.g. something like this:

cram_md5:
  driver = cram_md5
  public_name = CRAM-MD5
  client_name = MyName
  client_secret = MySecret

fixed_plain:
  driver = plaintext
  public_name = PLAIN
  client_send = ^MyName^MySecret

fixed_login:
  driver = plaintext
  public_name = LOGIN
  client_send = : MyName : MySecret

Of course replace the MyName and MySecret.

1
  • Which formula should be used in the MyName section? Plain sAMAccountName, userPrincipalName, or the domain_name\sAMAccountName form? – Gergely Lukacsy Aug 8 '19 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.