I've deployed a django website with Heroku. When a user creates an account in the app, a validation email is supposed to be sent. Do do that, I'm using smtp from gmail, and in my account settings, I've activated "less secure app access".
This works perfectly fine on my local machine, but when using the deployed app, I can't get the email to be sent.
The first time, I got a security warning from google saying someone connected to my account. I said it was me and tried again. I didn't get any other security warning but it seems the app is still unable to send emails.
Please, let me know if you have any idea what the issue might be.
Thanks.
Related
** SOLVED - see my answer below **
I'm using Django allauth to send verification emails when users register for an account. However, the emails continue to send from 'example.com' and to include the default message (also from example.com). So far I have:
changed the domain and display names in the 'Sites' section of Django admin
added the site ID number in settings
set the 'DEFAULT_FROM' email in settings
added my own email_confirmation_subject.txt and email_confirmation_message.txt under templates/account/email
When performing the registration procedure locally, the validation emails send to the terminal from the desired email address; however, the message in the body of the email remains the generic allauth message. When registering over the deployed site, at Heroku, however, the validation emails continue to show as being sent from 'example.com', both in the subject and the body of the email (even though the deployed site is up-to-date with the local).
Alright, so I finally, facepalmingly, worked this out. The problem was that I didn't realize there were two django admins in play here, one for the project deployed locally and another for the project deployed on Heroku. And I had only changed the 'Sites' details for the local admin, which is why the correct message sent to the terminal when the site ran locally but 'example.com' continued to send from the deployed site on Heroku. Now that I've updated the 'Sites' section from the Heroku Django admin, the emails send as desired.
I have configured my Django settings to send an e-mail using gmail (for password reset)
However, I'm facing a strange behaviour from Google:
Locally, it works fine, when I use my Django app and I get the report that an email has been sent;
Deployed on DigitalOcean, using the shell, it works fine:
>>> from django.core.mail import send_mail
>>> send_mail("Objet3", "Message body", "from.eg#gmail.com",['to.eg#gmail.com'], fail_silently=False)
1
However, when using the deployed app, I always get a Server Error 500, which is reported as such by Sentry:
SMTPSenderRefused: (530, b'5.7.0 Authentication Required. Learn more at\n5.7.0 https://support.google.com/mail/?p=WantAuthError f6sm10267338edk.13 - gsmtp', 'webmaster#localhost')
It's really puzzling, as at Gmail:
I have decreased the level of security,
I have created an App pass and implemented it...
Does anyone have an idea, where it may come from ?
Google does not want to be an email provider like this so they've made it increasingly difficult. Look into a provider such as sendgrid, mailgun, or others.
Finally SendGrid was a reasonable and practical solution, as I could configure it to :
send e-mails with my own domain name,
certify the e-mail so it doesn't fall into the spams
and they have a plan for free, absolutely useful in development phase.
Thank you Schillingt for your piece of advice.
I am trying to send email from my Django application. For this, I have used Twilio SendGrid service. Though my application can send the email, it ends up in spam folder. So, I have followed this tutorial to authenticate my domain which I bought from AWS route 53. In sendgrid, the domain authentication status shows 'verified' but the emails are still sent to spam folder. I have not created any MX or TXT record in DNS setting as the tutorial says it was created automatically during domain authentication in sendgrid.
One thing I have noticed that the email still shows, 'via.sendgrid.net' message (attached an image below) with the email. Whereas it should be my authenticated domain name. I have created sendgrid account with an outlook email and using that address to send email from Django app. Is this the reason my emails are going to spam? Or can anyone please help me to find a solution for this problem? Thanks in advance.
FYI: I have done 'Single Sender Verification' in sendgrid during developing this app. But now I have deployed it in aws. I guess this feature is still working instead of 'Domain Authentication'.
I've installed the Android app on facebook developer app page, set everything in the same manner as for the app for which there was no such error. Opening for Facebook login the exact same URL that works for the other app:
"https://www.facebook.com/v2.8/dialog/oauth?
client_id=myClientId
&scope=publish_actions
&response_type=granted_scopes &redirect_uri=https://www.facebook.com/connect/login_success.html"
);
I've added https://www.facebook.com/connect/login_success.html to the Valid Oauth URIs in my app settings of course. My app has everything set the same way for both apps, except for their package names, yet for this one I get 'URL blocked: This redirect failed because the redirect URI is not whitelisted in the app's Client OAuth Settings.' But it is!
So I don't understand, obviously Facebook sends me the wrong error message so it's impossible to figure out where's the bug.
I've solved it by waiting about an hour and trying again. So apparently this is not mentioned in the docs anywhere but it can take really long before a new Facebook app gets registered and until then no URI can be whitelisted. This means if you just added your app and you're getting this error message no matter what you've tried of the dozens of suggestions you find on the web, it's most likely not your fault, just wait. I wish I knew this before trying all those things.
I have a django app on heroku an using sendgrid.
I have gotten messages from a number of users with gmail email addresses saying that they have not received their validation emails after registering to use the site.
I tested it myself, and found that while emails with other addresses go through instantly, but for some gmail accounts it is not going through.
In the sendgrid dashboard, however, it says that all the emails have been delivered.
Can someone tell me what the issue here is? Is gmail blocking emails from my site? It just started happening these last two days. And we're not really sending out that many emails (10 or so a day)
Do the Emails end up in a spam folder, or do they truly disappear?
What kind of plan are you on at SendGrid? If you have your own dedicated IP, have you followed the guidelines on 'warming up' that IP address? Might also want to review the content of the message with SendGrid support, see if they can make any recommendations.
Emails end up in the spam folder. Whenever an email was sent from Heroku, Sendgrid to #gmail accounts, they were viewed as spam by Gmail.
I have the same problem and did not find a solution yet.