0

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:

  == to@address.com 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.

I also tried replacing the variable to search for by a string i.e:

remote_login:
  driver = plaintext
  public_name = LOGIN
  hide client_send = ${lookup{email@domain.com}lsearch{/etc/differentlogin}{: different_username : different_passsword}{: remote_username : remote_password}

but I still get the same error.

To check the syntax of my conditional I tried to add the following to my remote_transport:

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

Any tips?

Many thanks

1

The reason for this issue is that the client_send value is a number of values in a colon separated list. The solution to the problem is therefore fixed by formatting the value as below:

${lookup{$authenticated_id}lsearch{/etc/differentlogin}{remote_username}{different_username}} : ${lookup{$authenticated_id}lsearch{/etc/differentlogin}{remote_password}{different_passsword}}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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