What is the configuration needed in Azure and Admin Center in order to send mails using SMTP OAuth and Java Mail?

Dhinesh Venkat 1 Reputation point
2022-10-18T13:56:53.98+00:00

Hi, I am using java mail to send mails and I have two fields in the UI, Sender E-mail Address and Username. In the backend,

Sender E-mail Address is used in javax.mail.internet.InternetAddress.setPersonal("abc@outlook.com");
Username is used in my my own implementation of javax.mail.Authenticator as Session.getInstance(properties, authenticator);

I believe, the following are the ways to configure my Mail Server using SMTP AUTH client submission.

  1. Use admin user account in both, Username field and Sender E-mail Address field.
  2. Use admin user account in Username field and non-admin user account with Send on Behalf permission in Sender E-mail Address field.
  3. Use non-admin account in both Username field and Sender E-mail Address field but the app registration should be done using the same account and the user account must have an Exchange Online License.

If an user tries to configure Mail Server without coming under any of the above case, I get 535 5.7.139 Authentication unsuccessful error

I want to provide an use case where the Mail Server can be configured without any admin address involved (Username field, Sender E-mail Address field or Consent approval), to achieve this, what set of permissions / roles / licences / settings is needed in both Azure and Admin Center.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
40,140 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.