introduce email bounce address, follow up on #221

This commit is contained in:
Hendrik Langer 2024-06-26 12:19:44 +02:00
parent 72320a0178
commit b7583e8370
3 changed files with 4 additions and 2 deletions

View file

@ -42,10 +42,10 @@ def send_welcome_email(user, application_required):
@celery.task
def send_async_email(subject, sender, recipients, text_body, html_body, reply_to):
if 'ngrok.app' in sender: # for local development
sender = f'{g.site.name} <{current_app.config["MAIL_FROM"]}>'
sender = 'PieFed <noreply@piefed.social'
return_path = 'bounces@piefed.social'
else:
return_path = 'bounces@' + current_app.config['SERVER_NAME']
return_path = current_app.config['BOUNCE_ADDRESS']
# NB email will not be sent if you have not verified your domain name as an 'Identity' inside AWS SES
if type(recipients) == str:
recipients = [recipients]

View file

@ -38,6 +38,7 @@ class Config(object):
BOUNCE_HOST = os.environ.get('BOUNCE_HOST') or ''
BOUNCE_USERNAME = os.environ.get('BOUNCE_USERNAME') or ''
BOUNCE_PASSWORD = os.environ.get('BOUNCE_PASSWORD') or ''
BOUNCE_ADDRESS = os.environ.get('BOUNCE_ADDRESS') or MAIL_FROM or ''
SENTRY_DSN = os.environ.get('SENTRY_DSN') or None

View file

@ -21,6 +21,7 @@ CACHE_REDIS_URL='redis://localhost:6379/1'
BOUNCE_HOST=''
BOUNCE_USERNAME=''
BOUNCE_PASSWORD=''
BOUNCE_ADDRESS=''
FLASK_APP = 'pyfedi.py'
SENTRY_DSN = ''