|Hi,

Currently I have my exim configuration set to send all e-mails using an external SMTP server. All users authenticate with my exim server with a local password and then the messages sent is relayed through a smarthost to a remote SMTP server, which uses a different login compared to the one used directly by the users connected to my exim server (running cPanel). Here's the current configuration:

    remote_route:
      driver = manualroute
      domains = !+local_domains
      transport = remote_transport
      route_list = * remotesmtpserver.com

    remote_transport:
      driver = smtp
      port = 587
      hosts_require_auth = <; $host_address
      hosts_require_tls = <; $host_address

    remote_login:
      driver = plaintext
      public_name = LOGIN
      hide client_send = : remote_username : remote_password

This all works well and as intended.

The problem is that I want to use a different remote_username and remote_password for a select group of users/senders. The login names (for my exim server) are full e-mail addresses, so I have added these e-mail addresses to a file /etc/differentlogin (i.e list of e-mail addresses separated by a new line).

I then tried following setup in the remote_login section:

    remote_login:
      driver = plaintext
      public_name = LOGIN
hide client_send = ${lookup{$authenticated_id}lsearch{/etc/differentlogin}{: different_username : different_passsword}{: remote_username : remote_password}

However this gives me the following EXIM error when attempting to send e-mails:

== [email protected] R=remote_route T=remote_transport defer (-48): expansion of "${lookup{$authenticated_id}lsearch{/etc/differentlogin}{" failed in mandrill_login authenticator: missing } at end of string

I attempted using $sender_address instead of $authenticated_id, but this gives me the same result.

Adding another } as suggest, i.e
|
|| hide client_send = ${lookup{$authenticated_id}lsearch{/etc/differentlogin}}{: different_username : different_passsword}{: remote_username : remote_password}

gives me failed login (the login details are correct, but maybe an additional } is added to the login instructions or something):

    SMTP<< 435 4.7.8 Error: authentication failed:|

To check the syntax of my conditional I tried to add the following to my remote_transport (without the additional } ):

headers_add = X-SenderTest: ${lookup{$authenticated_id}lsearch{/etc/differentlogin}{different}{normal}}

This works as expected and add the following header when sending an e-mail from the addresses/logins noted in the list /etc/differentlogin:

    X-SenderTest: different

Anyone got any tips? Is there a way I can log the username/password that is being used to login to the remote SMTP with?

I was originally going to create two different authenticators and two route/transport but I could find no way to have to plaintext authenticators and define a specific one for the different route/transport. If this is possible it may be cleaner that way.

Your help is much appreciated.

Jacob
|

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to