SMTP and other email realted settings
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
{% extends "admin/change_form.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block submit_buttons_bottom %}
|
||||
<div class="submit-row">
|
||||
<input type="submit" value="{% trans 'Save' %}" class="default" name="_save">
|
||||
<input type="submit" value="{% trans 'Save and continue editing' %}" name="_continue">
|
||||
|
||||
<a href="{% url 'admin:system_emailsettings_test_email' %}"
|
||||
class="button"
|
||||
style="float: right; background: #3b82f6; color: white; padding: 10px 20px; text-decoration: none; border-radius: 6px; margin-left: 10px;">
|
||||
📧 Send Test Email
|
||||
</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,97 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<div style="max-width: 800px; margin: 0 auto; padding: 20px;">
|
||||
<div style="background: white; border-radius: 8px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">
|
||||
<h2 style="margin-top: 0; color: #1f2937;">Send Test Email</h2>
|
||||
|
||||
<div style="background: #f0f9ff; border-radius: 6px; padding: 16px; margin-bottom: 24px; border-left: 4px solid #3b82f6;">
|
||||
<h4 style="margin: 0 0 12px 0; color: #1e40af;">Current Configuration</h4>
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px;">
|
||||
<p style="margin: 0; color: #1e3a5f; font-size: 14px;">
|
||||
<strong>Provider:</strong>
|
||||
<span style="background: {% if settings.email_provider == 'resend' %}#dbeafe{% else %}#fef3c7{% endif %};
|
||||
padding: 2px 8px; border-radius: 4px;">
|
||||
{{ settings.email_provider|upper }}
|
||||
</span>
|
||||
</p>
|
||||
<p style="margin: 0; color: #1e3a5f; font-size: 14px;">
|
||||
<strong>From Email:</strong> {{ settings.from_email }}
|
||||
</p>
|
||||
<p style="margin: 0; color: #1e3a5f; font-size: 14px;">
|
||||
<strong>From Name:</strong> {{ settings.from_name }}
|
||||
</p>
|
||||
<p style="margin: 0; color: #1e3a5f; font-size: 14px;">
|
||||
<strong>Reply-To:</strong> {{ settings.reply_to_email }}
|
||||
</p>
|
||||
</div>
|
||||
{% if settings.email_provider == 'smtp' %}
|
||||
<div style="margin-top: 12px; padding-top: 12px; border-top: 1px solid #bfdbfe;">
|
||||
<p style="margin: 0 0 4px 0; color: #1e3a5f; font-size: 14px;">
|
||||
<strong>SMTP Server:</strong> {{ settings.smtp_host }}:{{ settings.smtp_port }}
|
||||
</p>
|
||||
<p style="margin: 0; color: #1e3a5f; font-size: 14px;">
|
||||
<strong>Encryption:</strong>
|
||||
{% if settings.smtp_use_ssl %}SSL{% elif settings.smtp_use_tls %}TLS{% else %}None{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<form method="post" action="{% url 'admin:system_emailsettings_send_test' %}">
|
||||
{% csrf_token %}
|
||||
|
||||
<div style="margin-bottom: 20px;">
|
||||
<label style="display: block; font-weight: 500; color: #374151; margin-bottom: 8px;">
|
||||
Send Test Email To:
|
||||
</label>
|
||||
<input type="email" name="to_email" value="{{ default_to_email }}"
|
||||
style="width: 100%; padding: 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;"
|
||||
placeholder="recipient@example.com" required>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px;">
|
||||
<label style="display: block; font-weight: 500; color: #374151; margin-bottom: 8px;">
|
||||
Subject:
|
||||
</label>
|
||||
<input type="text" name="subject" value="IGNY8 Test Email"
|
||||
style="width: 100%; padding: 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;">
|
||||
</div>
|
||||
|
||||
<div style="display: flex; gap: 12px;">
|
||||
<button type="submit"
|
||||
style="background: #6366f1; color: white; padding: 12px 24px; border: none;
|
||||
border-radius: 6px; font-weight: 500; cursor: pointer; font-size: 14px;">
|
||||
📧 Send Test Email
|
||||
</button>
|
||||
<a href="{% url 'admin:system_emailsettings_changelist' %}"
|
||||
style="background: #e5e7eb; color: #374151; padding: 12px 24px;
|
||||
border-radius: 6px; font-weight: 500; text-decoration: none; font-size: 14px;">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style="background: #f0fdf4; border-radius: 8px; padding: 16px; margin-top: 20px; border-left: 4px solid #22c55e;">
|
||||
<h4 style="margin: 0 0 8px 0; color: #166534;">✅ What This Test Does</h4>
|
||||
<ul style="margin: 0; padding-left: 20px; color: #15803d; font-size: 14px;">
|
||||
<li>Sends a test email using your currently selected provider ({{ settings.email_provider|upper }})</li>
|
||||
<li>Verifies that your email configuration is working correctly</li>
|
||||
<li>Logs the email in Email Logs for tracking</li>
|
||||
<li>Shows the provider used and configuration details in the email body</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{% if settings.email_provider == 'smtp' and not settings.smtp_host %}
|
||||
<div style="background: #fef2f2; border-radius: 8px; padding: 16px; margin-top: 20px; border-left: 4px solid #ef4444;">
|
||||
<h4 style="margin: 0 0 8px 0; color: #991b1b;">⚠️ SMTP Not Configured</h4>
|
||||
<p style="margin: 0; color: #b91c1c; font-size: 14px;">
|
||||
You have selected SMTP as your email provider, but SMTP settings are not configured.
|
||||
Please go back and configure your SMTP server settings, or switch to Resend.
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user