switching mail services to mailgun

pull/3/head
lalanza808 5 years ago
parent e1a105ae3a
commit cf81b7f409

@ -1,8 +1,8 @@
Django==2.2.8 Django==2.2.8
boto3==1.10.45 boto3==1.10.45
Pillow==6.2.1 Pillow==6.2.1
django-anymail[mailgun]==7.0.0
django-cors-headers==3.2.0 django-cors-headers==3.2.0
django-sendgrid-v5==0.8.1
django-redis==4.11.0 django-redis==4.11.0
django-registration==3.0.1 django-registration==3.0.1
django-storages==1.8.0 django-storages==1.8.0

@ -42,7 +42,8 @@ INSTALLED_APPS = [
'sales.apps.SalesConfig', 'sales.apps.SalesConfig',
'core.apps.CoreConfig', 'core.apps.CoreConfig',
'huey.contrib.djhuey', 'huey.contrib.djhuey',
'corsheaders' 'corsheaders',
'anymail'
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -220,15 +221,18 @@ WALLET_PASS = os.environ.get('WALLET_PASS', '')
# Email info # Email info
DEFAULT_FROM_EMAIL = f'{SITE_NAME} <noreply@xmrauctions.com>' EMAIL_DOMAIN = os.environ.get('EMAIL_DOMAIN', 'localhost')
# EMAIL_HOST = os.environ.get('EMAIL_HOST', None) EMAIL_FROM = os.environ.get('EMAIL_FROM', 'noreply')
# EMAIL_PORT = os.environ.get('EMAIL_PORT', None) DEFAULT_FROM_EMAIL = f'{SITE_NAME} <{EMAIL_FROM}@{EMAIL_DOMAIN}>'
# EMAIL_USE_TLS = os.environ.get('EMAIL_USE_TLS', None) SERVER_EMAIL = DEFAULT_FROM_EMAIL
# EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER', None) ANYMAIL = {
# EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD', None) 'MAILGUN_API_KEY': os.environ.get('MAILGUN_API_KEY', None),
SENDGRID_API_KEY = os.environ.get('SENDGRID_API_KEY', False) "MAILGUN_SENDER_DOMAIN": os.environ.get('MAILGUN_SENDER_DOMAIN', EMAIL_DOMAIN),
if SENDGRID_API_KEY: }
EMAIL_BACKEND = 'sendgrid_backend.SendgridBackend'
if ANYMAIL['MAILGUN_API_KEY']:
print('emailgun')
EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"
else: else:
EMAIL_BACKEND = os.environ.get('EMAIL_BACKEND', 'django.core.mail.backends.console.EmailBackend') EMAIL_BACKEND = os.environ.get('EMAIL_BACKEND', 'django.core.mail.backends.console.EmailBackend')