you are trying to authorize api access with an admin user who is not registered the email setup. I got the same error at least when hitting the authorize api access button. solved by using an account connected to the setup to authorize, not admin user.
+20 1111817748
contact me on whatsapp i have the solution
Hey everyone, been having these problems as well. Managed to get a “no-reply” email working with M365, however my problem is that after a while (between 2h and 24h) it seems that the email account “loses” access to the API authorization, and I need to do the “Authorize API Access” loop again, otherwise it does not send out emails from Frappe. Any one has an idea about this?
Hi @PedroJACorreia:
Seems refresh token is not being generated …
Check your connected app doctype.
See this docs too:
https://frappeframework.com/docs/user/en/microsoft-email-oauth#service-principal-authentication
Hope this helps.
Hi avc, thanks for the quick reply.
Is there a way to force the token generation? Mine is being generated, but the problem persists; once I “Authorize API Access” in the email account menu for my no-reply account, it works just fine. But after a certain amount of time (1-2 hours) it seems to lose connection to M365 and asks for the “Authorize API Access” again. Doing it again makes it work again for a short time, then rinse and repeat.
I don’t have the “Authenticate as Service Princpal” checkbox as the documentation suggests. Is there something I’m missing?
Check your Token Cache. It needs to have refresh_token field populated. To obtain refresh token offline_access scope is required.
Not related to Microsoft, some providers may make it mandatory to “verify app” or set it up “production mode” to start obtaining refresh tokens.
We had App created from both the OAuth settings and Connected Apps. We deleted one from the OAuth page and kept the one from Connected Apps. Also make sure that, you are logged in with the same user and not as Admin. This shall work. Excellent work by Frappe with this connector.
Hello @avc,
do you know why i get the error “DNS_PROBE_FINISHED_NXDOMAIN” if i would like to api authorisation a new e-mail account?
Regards
Kevin
I had the same problem before and fixed it by checking the settings below in the Azure connected app settings. Might be worth a try.
Hey everyone,
I followed the tutorial provided by @avc and it works, nice thank you!
However I also want to connect my shared mailbox like @rmeyer proposes in his comment but in the current version of ERPNext v15 the Authorize API Access Button is gone…
Is there any workaround yet?
Edit: It was too late I guess… just click on save and it appears…
Hey guys,
We always encounter this error even though we’ve configured everything as per the setup:
“Please check your email credentials. smtplib.SMTPAuthenticationError: (451, b’4.7.0 Temporary server error. Please try again later. PRX5 [FR0P281CA0189.DEUP281.PROD.OUTLOOK.COM 2024-12-16T23:06:25.873Z 08DD1D73933D3035]')”
Feedback would be appreciated and is much needed!
I was able to make this work using exactly the steps described at the beginning of this post by @avc . THANK YOU SO MUCH!!!
The one thing I will add is that there appears to be two ways to set up the users:
- Set up each user’s inbound/outbound servers.
- Set up an Email Domain and use that for each user.
I chose option 2 because it is much simpler on a per user basis.
I had a lot of trouble getting O365 to accept the server setup so here are the steps I took to:
In Azure go to admin.microsoft.com
→ Show all
→ Exchange
to get to the Exchange admin center. In the Exchange Admin Center select Mail Flow
→ Connectors
and set up an email connector to allow your Frappe server to send email via the SMTP gateway.
I chose to use the IP address method for verification but if you can use a certificate. The IP address is the public IP address of the server.
This did not work for my dev environment on my PC because my ISP blocks the SMTP ports needed to make this work. It only worked in my hosted environment.
In Frappe, I went to Email Domain
and created a new email domain with these settings:
If this works, you will get a successful “Save” right away.
Finally, when I set up the user I used the Email Domain from above and selected the inbound and outbound options with “Disable SMTP server authentication” checked.
Hope this helps someone else.
I set everything up like the guide suggested and i can send and receive emails but i can not see inline images when looking at an email in erpnext. there is only the small icon that indicates that there should be an image. When sending from erpnext with an inline image i can see it on other clients. Iam sending between two email addresses of the same domain and use frappe cloud hosting. Anyone knows this issue ?