To test SMTP auth with StartTLS, I used the following method.
Base64 encode the username and password.
echo -ne "yourpassword" | base64 eW91cnBhc3N3b3Jk
echo -ne "your@email.com" | base64 eW91ckBlbWFpbC5jb20=
Connect to the SMTP server using the openssl client.
openssl s_client -connect smtp.test.com:587 -starttls smtp -crlf
Once connected to the mail server, identify myself with EHLO
or HELO
command.
ehlo there 250-smtp.test.com Hello [192.168.1.50] 250-SIZE 157286400 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-AUTH LOGIN XOAUTH2 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 SMTPUTF8
Next, issue an AUTH LOGIN command to begin login.
AUTH LOGIN 334 VXNlcm5hbWU6
I got 334 VXNlcm5hbWU6
response, which VXNlcm5hbWU6
is base64 for Username:
. I entered in the base64 encoded value for my username, your@email.com and hit enter.
eW91ckBlbWFpbC5jb20=
I got 334 UGFzc3dvcmQ6
response, which UGFzc3dvcmQ6
is base64 for Password:
. I entered in the base64 encoded value for my password, yourpassword and hit enter.
334 UGFzc3dvcmQ6 eW91cnBhc3N3b3Jk
The mail server verifies authentication, and in my case, it is successful.
235 2.7.0 Authentication successful