Im trying to use emailrelay in proxy mode...
I have an old software that sends through a SMTP server on localhost without authentication. I need to forward through an ISP smtp. This requires a username and password for each specific email account that sends.
Example:
Send email from account1@domain.com requires indentify with username account1@domain.com and password XXXXX, and send from account2@domain.com requires username account2@domain.com width password YYYYY.
Im using this emailrelay-start.bat
start "emailrelay" "C:\Program Files (x86)\emailrelay\emailrelay.exe" --as-proxy smtp.mydomain.com:587 --pid-file "C:\Program Files (x86)\emailrelay\emailrelay.pid" --verbose --spool-dir "C:\Spool" --remote-clients --client-tls --client-auth "C:\Program Files (x86)\emailrelay\emailrelay.auth"
and the following emailrelay.auth
LOGIN client account1@mydomain.com XXXXX
LOGIN client account2@mydomain.com YYYYY
The problem is that only the first account is properly authenticated and forwarded...
Mails from account2@mydomain.com are rejected
If I flip then works the second but not the first...
Any help is welcome.
Many thxxx
Sorry, it's not something you can do easily and I should put in a check to allow only one 'client' row in the secrets file. One way to send to multiple destinations is run an emailrelay server that copies its files into two spool directories (--as-server --filter=your-copy-script), and run a separate emailrelay forwarder from each. You could run the two forwarding emailrelays directly from your copy script (--as-client), or have them as long-running processes with polling (being careful to avoid races between the file copying and the file polling).
how about from based auth?
No, from-based authentication is not feasible within the scope of a simple SMTP relay. Authentication applies to an SMTP session, so it cannot be based on per-message attributes.