diff --git a/app.py b/app.py index 614c745..b64f4f8 100644 --- a/app.py +++ b/app.py @@ -806,6 +806,20 @@ def admin_settings(): flash('Email (SMTP) settings saved. Password stored encrypted.', 'success') return redirect(url_for('admin_settings')) + elif action == 'send_test_email': + # Send a test email to the address provided in the form. + test_to = request.form.get('test_email_address', '').strip() + if not test_to: + flash('Enter a test email address first.', 'error') + return redirect(url_for('admin_settings')) + try: + body = "Hi,\n\nThis is a test email from the Trollgorithm Theme Song Booth. If you're seeing this, SMTP is configured correctly." + send_email(test_to, 'SMTP Test from Theme Song Booth', body, inline_images=build_signature_images()) + flash(f'Test email sent to {test_to}.', 'success') + except Exception as e: + flash(f'Failed to send test email: {e}', 'error') + return redirect(url_for('admin_settings')) + elif action == 'save_refresh': # Update dashboard auto-refresh interval. val = request.form.get('refresh_seconds', '10').strip() diff --git a/templates/admin/settings.html b/templates/admin/settings.html index 178145c..a681e4c 100644 --- a/templates/admin/settings.html +++ b/templates/admin/settings.html @@ -266,6 +266,16 @@ + +