Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29755

How to configure Django and G Suite for SMTP

$
0
0

When the user is registering on my website an E-Mail is sent to the user to confirm his/her E-Mail. It works with this settings:

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'myemail@gmail.com'
EMAIL_HOST_PASSWORD = 'abcdefghiklmnopq'
EMAIL_PORT = 587

Now I want to switch to noreply@mydomain.com. I created an account on G Suite and made the following configurations:

Comprehensive mail storage (Locally applied)
Ensure that a copy of all sent and received mail is stored in associated users' mailboxes: ON

SMTP relay service (Locally applied)
ms_mail
Allowed senders: Only addresses in my domains
Only accept mail from the specified IP addresses: No
Require SMTP Authentication: Yes
Require TLS encryption: Yes

Less secure apps (Locally applied)
Allow Users to manage their access to less secure apps Less Secure Apps

Allow less secure apps: ON

Than I created an App Password an tried a lot of configurations like this:

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp-relay.gmail.com'
EMAIL_HOST_USER = 'noreply@mydomain.com'
EMAIL_HOST_PASSWORD = 'abcdefghiklmnopq'
DEFAULT_FROM_EMAIL = 'noreply@mydomain.com'
SERVER_EMAIL = 'noreply@mydomain.com'
EMAIL_PORT = 465

I can't find a good documentation on Google or Django how to configure the settings. Does anybody now a good resource? Is the App Password/Less secure Apps the right way to do it? Because Google has some security warnings. Noreply is a group but I created the app password for my.name@mydomain.com. Is this a problem when I am part of the group? I also tried several options with my.name@mydomain.com instead of noreply@mydomain.com but I always get the error

smtplib.SMTPServerDisconnected: Connection unexpectedly closed

Viewing all articles
Browse latest Browse all 29755

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>