Skip to content

Commit

Permalink
feat: Incoming Mail Log
Browse files Browse the repository at this point in the history
  • Loading branch information
s-aga-r committed Oct 28, 2024
1 parent e35db9f commit d810d37
Show file tree
Hide file tree
Showing 12 changed files with 607 additions and 33 deletions.
30 changes: 1 addition & 29 deletions mail_server/api/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from mail_server.utils.cache import get_root_domain_name, get_user_owned_domains
from mail_server.utils.user import has_role, is_system_manager
from mail_server.utils.validation import is_domain_registry_exists


@frappe.whitelist(methods=["POST"])
Expand Down Expand Up @@ -75,32 +76,3 @@ def validate_user_is_domain_owner(user: str, domain_name: str) -> None:

if domain_name not in get_user_owned_domains(user) and not is_system_manager(user):
frappe.throw(_("You are not authorized to perform this action."), frappe.PermissionError)


def is_domain_registry_exists(
domain_name: str, exclude_disabled: bool = True, raise_exception: bool = False
) -> bool:
"""Validate if the domain exists in the Mail Domain Registry."""

filters = {"domain_name": domain_name}
if exclude_disabled:
filters["enabled"] = 1

if frappe.db.exists("Mail Domain Registry", filters):
return True

if raise_exception:
if exclude_disabled:
frappe.throw(
_("Domain {0} does not exist or may be disabled in the Mail Domain Registry").format(
frappe.bold(domain_name)
),
frappe.DoesNotExistError,
)

frappe.throw(
_("Domain {0} not found in Mail Domain Registry").format(frappe.bold(domain_name)),
frappe.DoesNotExistError,
)

return False
5 changes: 4 additions & 1 deletion mail_server/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@
# "mail_server.tasks.monthly"
# ],
"cron": {
"* * * * *": ["mail_server.tasks.enqueue_push_emails_to_queue"],
"* * * * *": [
"mail_server.tasks.enqueue_push_emails_to_queue",
"mail_server.tasks.enqueue_fetch_emails_from_queue",
],
"*/2 * * * *": ["mail_server.tasks.enqueue_fetch_and_update_delivery_statuses"],
},
}
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt

// frappe.ui.form.on("Incoming Mail Log", {
// refresh(frm) {

// },
// });
Loading

0 comments on commit d810d37

Please sign in to comment.