From time to time you may find that you need to verify email user authentication in a client-agnostic way. The following process explains how you can perform such a test.
The first thing you need to do is get a base64 encoded version of the username and password. There are several ways to do this, for our purposes we'll use the following perl method:
perl -MMIME::Base64 -e 'print encode_base64("someuser\@somedomain.tld");' perl -MMIME::Base64 -e 'print encode_base64("somepassword");'
Save the returned values somewhere safe for the moment as you will need them later.
Next, access your server using telnet over port 25 (SMTP)
telnet yourserver.tld 25
Substituting yourserver.tld with the primary IP or the hostname of your server.
Next, we need to EHLO into the mail server:
Where yourdomain.tld is the domain you wish to test against.
Next, specify that you are attempting to authenticate:
The server should returned
334 VXNlcm5hbWU6;. This is the word "Username:" base64 encoded. On the new line created paste the base64 encoded username you created earlier; Using our example username that would be:
If successful, the server should return
334 UGFzc3dvcmQ6;. As previously this is the base64 encoded string "Password:". On the newest line enter your base64 encoded password; Once more using our example this would be:
Now you should have received a message telling you that you successfully authenticated.
[00:00:00 host root@server ~]cPs# telnet localhost 25
Connected to localhost.
Escape character is '^]'.
220-host.server.tld ESMTP Exim 4.94.2 #2 Sat, 19 Mar 2022 18:11:25 +0100
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
250-host.server.tld Hello somedomain.tld [::1]
250-AUTH PLAIN LOGIN
235 Authentication succeeded