@ricardo I just tested this on my own app password, and it successfully authenticated.
First, create base64 versions of your user@domain.com
and password
. For me, I just used base64 with php: base64_encode(<whatever>)
. However you want to do it, create two strings.
Then from linux command line:
openssl s_client -starttls smtp -crlf -connect smtp.office365.com:587
This will get you connected securely instead of having to send STARTTLS command. The result should look like:
CONNECTED(00000003)
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, CN = DigiCert Cloud Services CA-1
verify return:1
depth=0 C = US, ST = Washington, L = Redmond, O = Microsoft Corporation, CN = outlook.com
verify return:1
---
Certificate chain
0 s:C = US, ST = Washington, L = Redmond, O = Microsoft Corporation, CN = outlook.com
i:C = US, O = DigiCert Inc, CN = DigiCert Cloud Services CA-1
1 s:C = US, O = DigiCert Inc, CN = DigiCert Cloud Services CA-1
i:C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIIpjCCB46gAwIBAgIQBRY+dkz/tKL6OsKG/GC93zANBgkqhkiG9w0BAQsFADBL
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMSUwIwYDVQQDExxE
aWdpQ2VydCBDbG91ZCBTZXJ2aWNlcyBDQS0xMB4XDTIyMDcwNTAwMDAwMFoXDTIz
Start Time: 1657766875
Timeout : 7200 (sec)
Verify return code: 0 (ok)
Extended master secret: yes
---
250 SMTPUTF8
Then, do:
ehlo ricardo
(for our purposes it can be whatever you want to put there after ehlo)
It should respond with:
250-CH2PR07CA0051.outlook.office365.com Hello [your ip address]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH LOGIN XOAUTH2
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8
Does it show AUTH LOGIN?
Then do:
AUTH LOGIN
It should respond with a base64 version of “username”:
334 VXNlcm5hbWU6
Then, paste in your base64 version of your username, and submit it
It should respond with base64 version of “password”:
334 UGFzc3dvcmQ6
Then, paste in your base64 version of your app password, and submit it. If successful, you will see:
235 2.7.0 Authentication successful
You can QUIT to end the connection.