mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
make all email come from MAIL_FROM, closes #220
This commit is contained in:
parent
2f6e60ac40
commit
bde463cc1e
4 changed files with 7 additions and 7 deletions
|
@ -100,7 +100,7 @@ def send_newsletter(form):
|
||||||
else:
|
else:
|
||||||
to = recipient.email
|
to = recipient.email
|
||||||
|
|
||||||
send_email(subject=form.subject.data, sender=f'{g.site.name} <noreply@{current_app.config["SERVER_NAME"]}>', recipients=[to],
|
send_email(subject=form.subject.data, sender=f'{g.site.name} <{current_app.config["MAIL_FROM"]}>', recipients=[to],
|
||||||
text_body=body_text, html_body=body_html)
|
text_body=body_text, html_body=body_html)
|
||||||
|
|
||||||
if form.test.data:
|
if form.test.data:
|
||||||
|
|
|
@ -341,7 +341,7 @@ def register(app):
|
||||||
|
|
||||||
# Send email!
|
# Send email!
|
||||||
send_email(_('[PieFed] You have unread notifications'),
|
send_email(_('[PieFed] You have unread notifications'),
|
||||||
sender=f'PieFed <noreply@{current_app.config["SERVER_NAME"]}>',
|
sender=f'{g.site.name} <{current_app.config["MAIL_FROM"]}>',
|
||||||
recipients=[user.email],
|
recipients=[user.email],
|
||||||
text_body=flask.render_template('email/unread_notifications.txt', user=user,
|
text_body=flask.render_template('email/unread_notifications.txt', user=user,
|
||||||
notifications=notifications),
|
notifications=notifications),
|
||||||
|
|
|
@ -14,7 +14,7 @@ CHARSET = "UTF-8"
|
||||||
def send_password_reset_email(user):
|
def send_password_reset_email(user):
|
||||||
token = user.get_reset_password_token()
|
token = user.get_reset_password_token()
|
||||||
send_email(_('[PieFed] Reset Your Password'),
|
send_email(_('[PieFed] Reset Your Password'),
|
||||||
sender=f'PieFed <noreply@{current_app.config["SERVER_NAME"]}>',
|
sender=f'{g.site.name} <{current_app.config["MAIL_FROM"]}>',
|
||||||
recipients=[user.email],
|
recipients=[user.email],
|
||||||
text_body=render_template('email/reset_password.txt',
|
text_body=render_template('email/reset_password.txt',
|
||||||
user=user, token=token),
|
user=user, token=token),
|
||||||
|
@ -24,7 +24,7 @@ def send_password_reset_email(user):
|
||||||
|
|
||||||
def send_verification_email(user):
|
def send_verification_email(user):
|
||||||
send_email(_('[PieFed] Please verify your email address'),
|
send_email(_('[PieFed] Please verify your email address'),
|
||||||
sender=f'PieFed <noreply@{current_app.config["SERVER_NAME"]}>',
|
sender=f'{g.site.name} <{current_app.config["MAIL_FROM"]}>',
|
||||||
recipients=[user.email],
|
recipients=[user.email],
|
||||||
text_body=render_template('email/verification.txt', user=user),
|
text_body=render_template('email/verification.txt', user=user),
|
||||||
html_body=render_template('email/verification.html', user=user))
|
html_body=render_template('email/verification.html', user=user))
|
||||||
|
@ -33,7 +33,7 @@ def send_verification_email(user):
|
||||||
def send_welcome_email(user, application_required):
|
def send_welcome_email(user, application_required):
|
||||||
subject = _('Your application has been approved - welcome to PieFed') if application_required else _('Welcome to PieFed')
|
subject = _('Your application has been approved - welcome to PieFed') if application_required else _('Welcome to PieFed')
|
||||||
send_email(subject,
|
send_email(subject,
|
||||||
sender=f'PieFed <{g.site.contact_email}>',
|
sender=f'{g.site.name} <{current_app.config["MAIL_FROM"]}>',
|
||||||
recipients=[user.email],
|
recipients=[user.email],
|
||||||
text_body=render_template('email/welcome.txt', user=user, application_required=application_required),
|
text_body=render_template('email/welcome.txt', user=user, application_required=application_required),
|
||||||
html_body=render_template('email/welcome.html', user=user, application_required=application_required))
|
html_body=render_template('email/welcome.html', user=user, application_required=application_required))
|
||||||
|
@ -42,7 +42,7 @@ def send_welcome_email(user, application_required):
|
||||||
@celery.task
|
@celery.task
|
||||||
def send_async_email(subject, sender, recipients, text_body, html_body, reply_to):
|
def send_async_email(subject, sender, recipients, text_body, html_body, reply_to):
|
||||||
if 'ngrok.app' in sender: # for local development
|
if 'ngrok.app' in sender: # for local development
|
||||||
sender = 'PieFed <noreply@piefed.social>'
|
sender = f'{g.site.name} <{current_app.config["MAIL_FROM"]}>'
|
||||||
return_path = 'bounces@piefed.social'
|
return_path = 'bounces@piefed.social'
|
||||||
else:
|
else:
|
||||||
return_path = 'bounces@' + current_app.config['SERVER_NAME']
|
return_path = 'bounces@' + current_app.config['SERVER_NAME']
|
||||||
|
|
|
@ -440,7 +440,7 @@ def test():
|
||||||
|
|
||||||
# Send email!
|
# Send email!
|
||||||
send_email(_('[PieFed] You have unread notifications'),
|
send_email(_('[PieFed] You have unread notifications'),
|
||||||
sender=f'PieFed <noreply@{current_app.config["SERVER_NAME"]}>',
|
sender=f'{g.site.name} <{current_app.config["MAIL_FROM"]}>',
|
||||||
recipients=[user.email],
|
recipients=[user.email],
|
||||||
text_body=flask.render_template('email/unread_notifications.txt', user=user, notifications=notifications),
|
text_body=flask.render_template('email/unread_notifications.txt', user=user, notifications=notifications),
|
||||||
html_body=flask.render_template('email/unread_notifications.html', user=user,
|
html_body=flask.render_template('email/unread_notifications.html', user=user,
|
||||||
|
|
Loading…
Add table
Reference in a new issue