Since I have a dialup connection I let qmail send all outgoing mail to a mail relay.
Usually I don't send my mail via the mail relay from my ISP but via mail.gmx.de. This relay requires an authentication to accept mail, which isn't for a "gmx.de" account.
So I patched qmail-remote, which has the job of sending mail to other mail servers. Now qmail-remote is able to authenticate to another mail server via the methods CRAM-MD5, PLAIN and LOGIN. (If CRAM-MD5 is supported it will use CRAM-MD5, otherwise PLAIN, otherwise LOGIN.) qmail-remote parses the response to the EHLO command to decide which methods are supported.
To be able to authenticate, qmail-remote needs to
know about your remote username and password. This information
has to be stored in a new controlfile called remotesecrets.
(Control files are stored under ".../qmail/control").
The syntax of the file is very simple: Each line contains
three strings, which are separated by a colon ":". The first
string is the name of the mail server. The second is the username
to use and the third the password for that username.
mail.gmx.de:MyUserName:MyPasswordqmail-remote will only authenticate to a server if the control file smtproutes defines the server as a relay server and if qmail-remote finds a user and password for that server.
If you find this patch useful, you can download it.
Update: Since 06 Apr 2004 the patch now tries all available authentication methods, when one fails. There seem to be servers out there, which obviously claim to support a method and then fail to do so. So now all advertised methods are tried; if still none succeeds, qmail-remote fails to deliver the mail.
Update: Since 30 May 2003 the patch includes support for mail servers, which don't understand the EHLO command. That was a problem with the previous version of the patch, because such servers were rejected.