When you need to troubleshoot SMTP issues, it is a known fact that a simple telnet to port 25 of the SMTP server in question would get you far. It will get you to see the problems.
When connecting to Office365 (outlook.com) to relay mail, and you want to check how things work, you can use openssl to wrap in StartTLS your old telnet connection by running this:
openssl s_client -starttls smtp -crlf -connect smtp.office365.com:587
From there, you can run your plain old “ehlo user” and all these commands like you are used to.
Just a small note about authentication: if you are facing SMTP which requires authentication, there are few methods you can use. Let’s assume your user is ‘use[email protected]’ and your password is ‘password’.
If you are allowed to use the PLAIN method, you need to generate the login/password string into base64, like this:
perl -MMIME::Base64 -e ‘print encode_base64(“\000user\@domain.com\000password”)’
You could use shell with base64 command to perform the convertion:
echo -ne ‘\[email protected]\0password’ | base64
The result would be a string similar in shape to this: AHVzZXJAZG9tYWluLmNvbQBwYXNzd29yZA==
Then enter the SMTP server at the right prompt:
AUTH PLAIN AHVzZXJAZG9tYWluLmNvbQBwYXNzd29yZA==
If you are allowed to use the LOGIN method, you need to generate base64 string for your user and your password separately, like this:
perl -MMIME::Base64 -e ‘print encode_base64(“user\@domain.com”)’
echo -ne ‘[email protected]’ | base64
The result is dXNlckBkb21haW4uY29t
Same goes for the password field. Choose which of the next two lines you wish to use:
perl -MMIME::Base64 -e ‘print encode_base64(“password”)’
echo -ne ‘password’ | base64
The result is cGFzc3dvcmQ=
Now, for the prompt, we will run:
We’ll get the base64 query for username, so we just type/paste the user base64, and press on Enter. Then we’ll get the base64 prompt for password, so we will type/paste the password base64, and press Enter.