evyd13 / django-o365mail Goto Github PK
View Code? Open in Web Editor NEWOffice 365 (O365) email backend for Django
License: MIT License
Office 365 (O365) email backend for Django
License: MIT License
Hi,
Thanks for this package! Just what I needed. It is well documented but it might be useful to also document the O365_ACTUALLY_SEND_IN_DEBUG setting which was preventing mail from being sent for me locally.
I get the below error when try to send an email:
400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/sendMail | Error Message: Resource not found for the segment 'sendMail'.
I do all instructions and I created an app in azure with the folling API permisions:
Any idea?
Thanks in advance
I am using this plugin trying to send mail using a client i added all config the token is always getting generated:
but try-catch do not handle any error when i try to send mail so its a success right? but i am not accepting any mail on destination what can be issue any1 has any idea???!
Happy coding
Hi.
Once I installed it package successfully how I get
can the following information from office365 to configure in settings.py?
O365_MAIL_CLIENT_ID = 'REPLACE THIS'
O365_MAIL_CLIENT_SECRET = 'REPLACE THIS'
O365_MAIL_TENANT_ID = 'REPLACE THIS'
You can refer to link to how to generate these information?
Hi
I try to setup up the package as your advice as a prior question.
this link #7
400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/sendMail | Error Message: Resource not found for the segment 'sendMail'.
I click to https://graph.microsoft.com/v1.0/sendMail in order to dig deeper into additional error
{"error":{"code":"InvalidAuthenticationToken","message":"Access token is empty.","innerError":{"date":"2022-11-24T13:45:25","request-id":"4b533efc-d806-4829-a506-ba03599ebd69","client-request-id":"4b533efc-d806-4829-a506-ba03599ebd69"}}}
Below are my code and configuration and package installation.
settings.py
EMAIL_BACKEND = 'django_o365mail.EmailBackend'
O365_MAIL_CLIENT_ID ='xxxxxxxxxxxxxxx'
O365_MAIL_CLIENT_SECRET ='yyyyzzzyyyyy'
O365_MAIL_TENANT_ID ='zzzzzzzzz'
O365_ACTUALLY_SEND_IN_DEBUG=True
views.py
from django.core.mail import BadHeaderError, send_mail
from django.http import HttpResponse
def send_mail_office365(request):
try:
send_mail(
subject='SmartApp - Test Sending Email',
message='Hi, ok',
from_email='[email protected]',
recipient_list=['[email protected]'])
except BadHeaderError:
return HttpResponse('Invalid header found.')
return render(request,
'app/pm_doc_gen_pdf.html',
{})
The last picture is what the azure administrator of my company set up.
Thank you for your advice
We run our website on a docker container which gives permission errors when trying to store files on it, which the default FileSystemTokenBackend does. O365 package also supports different token backends, such as EnvTokenBackend which stores the tokens in the environment. It would be nice if the token backend could be customized when using this package.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.