Today we have a tidbit from Run Your Own Mail Server, where I discuss debugging submission at the command line.
Don’t leap straight to OpenSSL or a TLS-aware netcat, though. Submission doesn’t take a straight username and password. Instead, you need a login string. If you’re supporting Microsoft clients, you need two. A login string is a precisely formatted username and/or password, encoded in Base64. Base64 is not an encryption method, but rather a way to transparently transfer binaries as plain text. Passwords are not binary, but they should include special characters that protocols might consider escapes. Figure out your submission string before starting debugging.
Postfix’s default authentication method is called PLAIN. A PLAIN login string is a single line encoded into Base64. You’ll see lots of examples using echo, but they are not portable between shells let alone between operating systems. Use printf(1)—not the shell’s built-in printf with its extensions and incompatibilities, but the standalone POSIX-compliant program.
This book is still open for sponsors, by the way. Get your name in the book and soil your reputation forever. For some value of forever, that is. The lifespan of a tech book is about five years. A pretty small forever.