79 lines
3.4 KiB
HTML
79 lines
3.4 KiB
HTML
{% extends 'admin/base.html' %}
|
|
{% block admin_content %}
|
|
<h2>Mail Server Settings</h2>
|
|
<div class="alert alert-info" style="max-width:600px;">
|
|
<strong>Recommended Gmail SMTP Settings:</strong><br>
|
|
<ul style="margin-bottom:0;">
|
|
<li><b>Server:</b> smtp.gmail.com</li>
|
|
<li><b>Port:</b> 587</li>
|
|
<li><b>Use TLS:</b> True</li>
|
|
<li><b>Username:</b> your Gmail address (e.g. yourname@gmail.com)</li>
|
|
<li><b>Password:</b> your Gmail <b>App Password</b> (not your regular password)</li>
|
|
<li><b>Default sender:</b> your Gmail address (e.g. yourname@gmail.com)</li>
|
|
</ul>
|
|
<small>To use Gmail SMTP, you must create an <a href="https://myaccount.google.com/apppasswords" target="_blank">App Password</a> in your Google Account security settings.</small>
|
|
</div>
|
|
<form method="post">
|
|
<div class="form-group">
|
|
<label for="enabled">Enable Email Sending</label>
|
|
<input type="checkbox" id="enabled" name="enabled" value="1" {% if settings and settings.enabled %}checked{% endif %}>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="provider">Provider</label>
|
|
<select id="provider" name="provider" class="form-control">
|
|
<option value="smtp" {% if settings and settings.provider == 'smtp' %}selected{% endif %}>SMTP</option>
|
|
<option value="mailrise" {% if settings and settings.provider == 'mailrise' %}selected{% endif %}>Mailrise</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="server">Server</label>
|
|
<input type="text" id="server" name="server" class="form-control" value="{{ settings.server if settings else '' }}">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="port">Port</label>
|
|
<input type="number" id="port" name="port" class="form-control" value="{{ settings.port if settings else '' }}">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="use_tls">Use TLS</label>
|
|
<input type="checkbox" id="use_tls" name="use_tls" value="1" {% if settings and settings.use_tls %}checked{% endif %}>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="username">Username</label>
|
|
<input type="text" id="username" name="username" class="form-control" value="{{ settings.username if settings else '' }}">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" name="password" class="form-control" value="{{ settings.password if settings else '' }}">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="default_sender">Default Sender</label>
|
|
<input type="text" id="default_sender" name="default_sender" class="form-control" value="{{ settings.default_sender if settings else '' }}">
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Save Settings</button>
|
|
</form>
|
|
<hr>
|
|
<h3>Sent Emails Log</h3>
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Date</th>
|
|
<th>Recipient</th>
|
|
<th>Subject</th>
|
|
<th>Status</th>
|
|
<th>Error</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for email in sent_emails %}
|
|
<tr>
|
|
<td>{{ email.sent_at.strftime('%Y-%m-%d %H:%M') }}</td>
|
|
<td>{{ email.recipient }}</td>
|
|
<td>{{ email.subject }}</td>
|
|
<td>{{ email.status }}</td>
|
|
<td>{{ email.error or '' }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% endblock %}
|