harishkrupo / oauth2ms

Apache License 2.0
70 stars 20 forks source link

Sending failed SMTPclient is disabled for the tenant #20

Open averter opened 1 year ago

averter commented 1 year ago

Thank you very much for developing this package which allows me to receive emails from my work email account using mbsync. However, I am unable to use it to send emails. At my work they use a O365 server and SMTP Authentication is disabled. I am not sure if this package assumes that this option must be turned on? Specifically, when I try to send an email with the suggested configuration for SMTP

Sending...
Sending via mail...
auth-source-search: found 1 backends matching (:max 1 :host "smtp.office365.com" :port "587")
Decrypting /home/myusername/.authinfo.gpg...done
auth-source-search-backend: got 1 (max 1) in netrc:~/.authinfo.gpg matching (:max 1 :host "smtp.office365.com" :port "587")
auth-source-search: found 1 results (max 1) matching (:max 1 :host "smtp.office365.com" :port "587")
auth-source-search: found 1 backends matching (:host "smtp.office365.com" :port "587" :user nil :max 1 :require nil :create nil)
auth-source-netrc-parse: using CACHED file data for ~/.authinfo.gpg
auth-source-search-backend: got 1 (max 1) in netrc:~/.authinfo.gpg matching (:host "smtp.office365.com" :port "587" :user nil :max 1 :require nil :create nil)
auth-source-search: found 1 results (max 1) matching (:host "smtp.office365.com" :port "587" :user nil :max 1 :require nil :create nil)
[mu4e] Update process returned with non-zero exit code
535 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit https://aka.ms/smtp_auth_disabled for more information. [FR3P281CA0054.DEUP281.PROD.OUTLOOK.COM]
221 2.0.0 Service closing transmission channel
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. [FR3P281CA0054.DEUP281.PROD.OUTLOOK.COM] in response to AUTH

At a broader level, if nowadays SMTP is being disabled by MS what protocol is actually supported to send emails, and is there a way to replicate it? Thank you in advance for any help.

My msmtprc config file is

account work
host smtp.office365.com
from myusername@myworkemail.com
port 587
user rnadom@myworkemail.com
passwordeval gpg2 -q --for-your-eyes-only --no-tty -d ~/.authinfo.gpg | awk '/machine smtp.office365.com login rnadom@myworkemail.com/ {print $NF}'
auth login
tls on
tls_starttls on
tls_certcheck on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log
averter commented 1 year ago

Update: As I suspected effectively in the Azure app setup there is a "SMTP.Send" permission option which needs to be ticked on. Unfortunately when I try to access the Azure Active Directory I am greeted with a nice "You do not have access" message... This gets back to my fundamental question. If SMTP is disabled, what protocol do MS uses in outlook, and can it be emulated in some way in emacs? Thank you in advance.

jon-peel commented 10 months ago

I have SMTP.Send enabled, but I also get this error.