0

I have managed to configure oauth2ms to download emails via IMAP from my workplace account and have now hit a roadblock when trying to SEND emails. Specifically, I have this authentication error

smtpmail-send-it: Sending failed: 535 5.7.139 Authentication
unsuccessful, SmtpClientAuthentication is disabled for the
Tenant. Visit https://aka.ms/smtp_auth_disabled for more
information. [AM0PR19CA0038.WONDERLAND10.PROD.OUTLOOK.COM] in
response to AUTH

Same issue reported here link which implies that SMTPAuthentication is disabled. I have tried to ask to IT services to open an exception, and enable SMTP Auth for me, but that is beyond impossible/a definite lost battle. So my question is if there is any workaround? In the sense that if smtp auth is disabled what other protocol can be used/emulated instead?

If relevant my msmtprc file looks like this

account workplace
host smtp.office365.com
from myusname@mywplace
port 587
user [email protected]
passwordeval gpg2 -q --for-your-eyes-only --no-tty -d ~/.authinfo.gpg | awk '/machine smtp.office365.com login myusname@mywplace/ {print $NF}'
auth XOAUTH2
tls on
tls_starttls on
tls_certcheck on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log

and I am using mu4e v1.8.11 mbsync v1.4.4, msmtp v1.8.16, emacs v27.1. Thank you in advance.

Update 1

Related question here.

Possible person who solved the issue in two github threads here and here

Update 2

I suspect that the problem might be easier to solve than what I first thought. If smtp authentication is disabled, could it be that the solution is as simple as turning the authentication off in .msmtprc? Like so

account myworkaccount
host smtp.office365.com
port 587
auth off
tls off
tls_starttls off
from myworkemail@myworkplace
user myworkemail@myworkplace
logfile ~/.msmtp.log

This does not work and it seems very insecure not to have some form of authentication when sending emails, but I am running out of ideas of what else must be done. Again the fundamental question is "how can emails be sent in outlook and not in other apps?"

4
  • Have you considered using Davmail instead? I am using it in conjunction with mu4e in a company environment and it works quite well.
    – Martin
    Nov 9, 2022 at 16:48
  • @Martin. Indeed I have/am trying it as well with less success (can't even receive emails). This is the issue that I have opened in davmail's github github.com/mguessan/davmail/issues/248. Are you able to share your configuration perhaps? Thanks.
    – Ajned
    Nov 9, 2022 at 16:56
  • Which configuration are you referring to? Mbsync or Davmail?
    – Martin
    Nov 10, 2022 at 18:15
  • Davmail. I know how to link davmail and mbsync together. The problem is to link davmail with the o365 server...
    – Ajned
    Nov 11, 2022 at 8:22

2 Answers 2

1

@ajned: I checked my davmail configuration. I basically only configured

davmail.mode=EWS
davmail.url=https://webmail.company.com/owa

the rest are default settings. But I noticed, that your question was related to Office365, so my configuration may not work for you, as this is for a standard Exchange server.

3
  • Thanks Martin. Before trying your solution can you confirm that your smtp authentication is disabled? I might be misinterpreting what this actually means (see my update in the question)
    – Ajned
    Nov 16, 2022 at 15:32
  • @Ajned Davmail provides an SMTP port towards the client application, but towards the exchange server it doesn't use SMTP at all, but some MS-specific protocol. Therefore from my understanding it's irrelevant, if SMTP authentication is disabled on the Exchange server.
    – Martin
    Nov 17, 2022 at 17:26
  • Thanks. I have tried using your setup, with davmail.url=https://outlook.office.com/owa/ but I just keep receiving an error message from davmail Exchange login exception: Not Found, presumably because this is not an Exchange server. Thanks for the help/suggestion though.
    – Ajned
    Nov 20, 2022 at 10:01
0

I have managed to solve this by using davmail, as suggested by @Martin, but by using o365 Interactive. The DUO security system that I had to get through had a bug which prevented davmail's "o365 Interactive" mode to work, but that fortunately has recently been fixed.

My msmtprc configuration is as follows:

account work
host localhost
port 1026
auth login
tls off
from [email protected]
user [email protected]
passwordeval gpg2 -q --for-your-eyes-only --no-tty -d ~/.authinfo.gpg | awk '/machine smtp.office365.com login [email protected]/ {print $NF}'
logfile ~/.msmtp.log

2
  • Thank you. I am trying to use DavMail. It seems to be working with mbsync, but MU4E is not able to send emails. Was there any other config you needed to do? Do you still use msmtprc with DavMail? Sep 5, 2023 at 11:31
  • 1
    @JonathanPeel Indeed. I've added my msmtprc configuration above. Hope it helps.
    – Ajned
    Sep 6, 2023 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.