2025-06-07 10:48:03 +01:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
2025-06-08 11:13:43 +01:00
|
|
|
{% block title %}Senders - Email Server Management{% endblock %}
|
|
|
|
|
{% block page_title %}Sender Management{% endblock %}
|
2025-06-07 10:48:03 +01:00
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
|
|
|
<h2>
|
|
|
|
|
<i class="bi bi-people me-2"></i>
|
2025-06-08 11:13:43 +01:00
|
|
|
Senders
|
2025-06-07 10:48:03 +01:00
|
|
|
</h2>
|
2025-06-08 22:51:07 +01:00
|
|
|
<a href="{{ url_for('email.add_sender') }}" class="btn btn-primary">
|
2025-06-07 10:48:03 +01:00
|
|
|
<i class="bi bi-person-plus me-2"></i>
|
2025-06-08 11:13:43 +01:00
|
|
|
Add Sender
|
2025-06-07 10:48:03 +01:00
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-06-08 11:13:43 +01:00
|
|
|
{% if users %}
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-header">
|
|
|
|
|
<h6 class="mb-0">
|
|
|
|
|
<i class="bi bi-info-circle me-2"></i>
|
|
|
|
|
Sender Statistics
|
|
|
|
|
</h6>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<ul class="list-unstyled mb-0">
|
|
|
|
|
<li class="mb-2">
|
|
|
|
|
<i class="bi bi-check-circle text-success me-2"></i>
|
|
|
|
|
<strong>Active Senders:</strong> {{ users|selectattr('0.is_active')|list|length }}
|
|
|
|
|
</li>
|
|
|
|
|
<li class="mb-2">
|
|
|
|
|
<i class="bi bi-star text-warning me-2"></i>
|
|
|
|
|
<strong>Domain Sender:</strong> {{ users|selectattr('0.can_send_as_domain')|list|length }}
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<i class="bi bi-person text-info me-2"></i>
|
|
|
|
|
<strong>Regular Senders:</strong> {{ users|rejectattr('0.can_send_as_domain')|list|length }}
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-header">
|
|
|
|
|
<h6 class="mb-0">
|
|
|
|
|
<i class="bi bi-lightbulb me-2"></i>
|
|
|
|
|
Permission Levels
|
|
|
|
|
</h6>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<ul class="list-unstyled mb-0">
|
|
|
|
|
<li class="mb-2">
|
|
|
|
|
<span class="badge bg-warning me-2" style="color: black;">Domain Sender</span>
|
|
|
|
|
Can send as any email address in their domain
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<span class="badge bg-info me-2" style="color: black;">Regular Sender</span>
|
|
|
|
|
Can only send as their own email address
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
2025-06-07 10:48:03 +01:00
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-header">
|
|
|
|
|
<h5 class="mb-0">
|
|
|
|
|
<i class="bi bi-list-ul me-2"></i>
|
2025-06-08 11:13:43 +01:00
|
|
|
All Senders
|
2025-06-07 10:48:03 +01:00
|
|
|
</h5>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card-body p-0">
|
|
|
|
|
{% if users %}
|
|
|
|
|
<div class="table-responsive">
|
|
|
|
|
<table class="table table-dark table-hover mb-0">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Email</th>
|
|
|
|
|
<th>Domain</th>
|
|
|
|
|
<th>Permissions</th>
|
|
|
|
|
<th>Status</th>
|
|
|
|
|
<th>Created</th>
|
|
|
|
|
<th>Actions</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{% for user, domain in users %}
|
|
|
|
|
<tr>
|
|
|
|
|
<td>
|
|
|
|
|
<div class="fw-bold">{{ user.email }}</div>
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
<span class="badge bg-secondary">{{ domain.domain_name }}</span>
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
{% if user.can_send_as_domain %}
|
2025-06-08 11:13:43 +01:00
|
|
|
<span class="badge bg-warning" style="color: black;">
|
2025-06-07 10:48:03 +01:00
|
|
|
<i class="bi bi-star me-1"></i>
|
2025-06-08 11:13:43 +01:00
|
|
|
Domain Sender
|
2025-06-07 10:48:03 +01:00
|
|
|
</span>
|
|
|
|
|
<br>
|
|
|
|
|
<small class="text-muted">Can send as *@{{ domain.domain_name }}</small>
|
|
|
|
|
{% else %}
|
2025-06-08 11:13:43 +01:00
|
|
|
<span class="badge bg-info" style="color: black;">
|
2025-06-07 10:48:03 +01:00
|
|
|
<i class="bi bi-person me-1"></i>
|
2025-06-08 11:13:43 +01:00
|
|
|
Regular Sender
|
2025-06-07 10:48:03 +01:00
|
|
|
</span>
|
|
|
|
|
<br>
|
|
|
|
|
<small class="text-muted">Can only send as {{ user.email }}</small>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
{% if user.is_active %}
|
|
|
|
|
<span class="badge bg-success">
|
|
|
|
|
<i class="bi bi-check-circle me-1"></i>
|
|
|
|
|
Active
|
|
|
|
|
</span>
|
|
|
|
|
{% else %}
|
|
|
|
|
<span class="badge bg-danger">
|
|
|
|
|
<i class="bi bi-x-circle me-1"></i>
|
|
|
|
|
Inactive
|
|
|
|
|
</span>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
<small class="text-muted">
|
|
|
|
|
{{ user.created_at.strftime('%Y-%m-%d %H:%M') }}
|
|
|
|
|
</small>
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
2025-06-07 11:57:21 +01:00
|
|
|
<div class="btn-group" role="group">
|
|
|
|
|
<!-- Edit Button -->
|
2025-06-08 22:51:07 +01:00
|
|
|
<a href="{{ url_for('email.edit_sender', user_id=user.id) }}"
|
2025-06-07 11:57:21 +01:00
|
|
|
class="btn btn-outline-primary btn-sm"
|
2025-06-08 11:13:43 +01:00
|
|
|
title="Edit Sender">
|
2025-06-07 11:57:21 +01:00
|
|
|
<i class="bi bi-pencil"></i>
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
<!-- Enable/Disable Button -->
|
|
|
|
|
{% if user.is_active %}
|
2025-06-08 22:51:07 +01:00
|
|
|
<form method="post" action="{{ url_for('email.delete_sender', user_id=user.id) }}" class="d-inline">
|
2025-06-07 11:57:21 +01:00
|
|
|
<button type="submit"
|
|
|
|
|
class="btn btn-outline-warning btn-sm"
|
2025-06-08 11:13:43 +01:00
|
|
|
title="Disable Sender"
|
2025-06-07 11:57:21 +01:00
|
|
|
onclick="return confirm('Disable user {{ user.email }}?')">
|
|
|
|
|
<i class="bi bi-pause-circle"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
{% else %}
|
2025-06-08 22:51:07 +01:00
|
|
|
<form method="post" action="{{ url_for('email.enable_sender', user_id=user.id) }}" class="d-inline">
|
2025-06-07 11:57:21 +01:00
|
|
|
<button type="submit"
|
|
|
|
|
class="btn btn-outline-success btn-sm"
|
2025-06-08 11:13:43 +01:00
|
|
|
title="Enable Sender"
|
2025-06-07 11:57:21 +01:00
|
|
|
onclick="return confirm('Enable user {{ user.email }}?')">
|
|
|
|
|
<i class="bi bi-play-circle"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
<!-- Permanent Remove Button -->
|
2025-06-08 22:51:07 +01:00
|
|
|
<form method="post" action="{{ url_for('email.remove_sender', user_id=user.id) }}" class="d-inline">
|
2025-06-07 10:48:03 +01:00
|
|
|
<button type="submit"
|
|
|
|
|
class="btn btn-outline-danger btn-sm"
|
2025-06-08 11:13:43 +01:00
|
|
|
title="Permanently Remove Sender"
|
2025-06-07 11:57:21 +01:00
|
|
|
onclick="return confirm('Permanently remove user {{ user.email }}? This cannot be undone!')">
|
2025-06-07 10:48:03 +01:00
|
|
|
<i class="bi bi-trash"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
2025-06-07 11:57:21 +01:00
|
|
|
</div>
|
2025-06-07 10:48:03 +01:00
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
{% else %}
|
|
|
|
|
<div class="text-center py-5">
|
|
|
|
|
<i class="bi bi-people text-muted" style="font-size: 4rem;"></i>
|
2025-06-08 11:13:43 +01:00
|
|
|
<h4 class="text-muted mt-3">No senders configured</h4>
|
|
|
|
|
<p class="text-muted">Add sender to enable username/password authentication</p>
|
2025-06-08 22:51:07 +01:00
|
|
|
<a href="{{ url_for('email.add_sender') }}" class="btn btn-primary">
|
2025-06-07 10:48:03 +01:00
|
|
|
<i class="bi bi-person-plus me-2"></i>
|
2025-06-08 11:13:43 +01:00
|
|
|
Add Your First Sender
|
2025-06-07 10:48:03 +01:00
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{% endblock %}
|