make email send issues non-fatal.

This commit is contained in:
2026-07-01 17:30:35 -06:00
parent be076c07a7
commit 404b0f508c
2 changed files with 25 additions and 6 deletions

View File

@@ -46,14 +46,20 @@ for donation in donations:
except stripe.error.CardError:
donation.active = False
db.commit()
try:
send_declined(user, donation.amount)
except Exception as e:
print(f" • declined email failed: {e}")
print(" • declined")
continue
send_thank_you(user, donation.amount, True)
donation.updated = datetime.now()
donation.payments += 1
db.commit()
try:
send_thank_you(user, donation.amount, True)
except Exception as e:
print(f" • thank-you email failed: {e}")
else:
print(f"Skipping {donation}")

View File

@@ -269,8 +269,14 @@ def donate():
db.commit()
try:
send_thank_you(user, amount, type == DonationType.monthly)
except Exception as e:
print(f"Thank-you email failed: {e}")
try:
send_new_donation(user, donation)
except Exception as e:
print(f"New donation email failed: {e}")
if new_account:
return { "success": True, "new_account": new_account, "password_reset": user.password_reset }
@@ -283,7 +289,11 @@ def issue_password_reset(email):
return render_template("reset.html", errors="No one with that email found.")
user.password_reset = binascii.b2a_hex(os.urandom(20)).decode("utf-8")
user.password_reset_expires = datetime.now() + timedelta(days=1)
try:
send_password_reset(user)
except Exception as e:
print(f"Password reset email failed: {e}")
return render_template("reset.html", errors="Could not send password reset email.")
db.commit()
return render_template("reset.html", done=True)
@@ -346,7 +356,10 @@ def cancel(id):
abort(400)
donation.active = False
db.commit()
try:
send_cancellation_notice(current_user, donation)
except Exception as e:
print(f"Cancellation email failed: {e}")
return redirect("../panel")
@html.route("/invoice/<id>")