[exim] Reading "alias : username : password" from text file …

Top Page
Delete this message
Reply to this message
Author: Eugene Dzhurinsky
Date:  
To: exim-users
Subject: [exim] Reading "alias : username : password" from text file when sending an e-mail through GMail
Hello!

I've been using the way to authenticate in Goole while sending e-mails, as
described in http://thepaulprog.blogspot.com/2009/02/making-exim4-send-outgoing-mail-through.html - for years.

Now I want to be able to use an alias in FROM address, so instead of having a
password file containing lines like:

username : password

I need it like

alias : username : password

So once requested to send an e-mail, Exim will pick up the correct like by the
passed sender address matched agains alias, extract second item from string as
a username and third - as a password to be used for the authentication in Gmail.

I have tried the following approach:

PASSWDLINE=${sg{\
                ${lookup{$sender_address}\
                         nwildlsearch\
                         {/etc/mail/passwd.gmail}\
                         {$value}\
                         fail}\
               }\
               {\\N[\\^]\\N}\
               {^^}\
            }
login:
    driver = plaintext
    public_name = LOGIN


    # Return empty string if not non-TLS AND looking up
    # $host in passwd-file yields a non-empty string;
    # fail otherwise.
    client_send = "<; ${if and{\
                            {!eq{$tls_cipher}{}}\
                            {!eq{PASSWDLINE}{}}\
                           }\
                           {}fail}\
                    ; ${extract{2}{::}{PASSWDLINE}}\
                    ; ${sg{PASSWDLINE}{\\N([^:]+:)(.*)\\N}{\\$3}}"


However it doesn't work. I read the manual, but it seems to be
overcomplicated. I hope that somebody more skilled than me could help me with
this.

Thank you in advance!

--
Eugene Dzhurinsky