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 27, 2024
1 parent e35db9f commit 1d5d650
Show file tree
Hide file tree
Showing 6 changed files with 394 additions and 1 deletion.
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) {

// },
// });
Original file line number Diff line number Diff line change
@@ -0,0 +1,355 @@
{
"actions": [],
"creation": "2024-10-27 11:20:39.352529",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"section_break_ize8",
"sender",
"column_break_2taw",
"receiver",
"section_break_l5oq",
"recipients",
"more_info_tab",
"status",
"from_ip",
"from_host",
"spam_score",
"is_spam",
"column_break_gmtb",
"domain_name",
"agent",
"section_break_nmav",
"is_rejected",
"column_break_xy6m",
"rejection_message",
"section_break_vjs7",
"message_id",
"column_break_ia4p",
"message_size",
"section_break_zklh",
"created_at",
"received_at",
"processed_at",
"column_break_9aty",
"received_after",
"processed_after",
"section_break_iryz",
"spf",
"dkim",
"dmarc",
"column_break_2tlp",
"spf_description",
"dkim_description",
"dmarc_description",
"section_break_g31e",
"message"
],
"fields": [
{
"fieldname": "section_break_ize8",
"fieldtype": "Section Break"
},
{
"depends_on": "eval: doc.docstatus != 0",
"fieldname": "sender",
"fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Sender",
"no_copy": 1,
"read_only": 1,
"search_index": 1
},
{
"fieldname": "column_break_2taw",
"fieldtype": "Column Break"
},
{
"fieldname": "receiver",
"fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Receiver",
"no_copy": 1,
"read_only": 1,
"search_index": 1
},
{
"fieldname": "section_break_l5oq",
"fieldtype": "Section Break"
},
{
"fieldname": "recipients",
"fieldtype": "Table",
"label": "Recipients",
"no_copy": 1,
"options": "Mail Log Recipient",
"read_only": 1
},
{
"fieldname": "more_info_tab",
"fieldtype": "Tab Break",
"label": "More Info"
},
{
"default": "In Progress",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Status",
"no_copy": 1,
"options": "In Progress\nRejected\nAccepted",
"read_only": 1,
"search_index": 1
},
{
"fieldname": "from_ip",
"fieldtype": "Data",
"label": "From IP",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "from_host",
"fieldtype": "Data",
"label": "From Host",
"no_copy": 1,
"read_only": 1
},
{
"default": "0",
"fieldname": "spam_score",
"fieldtype": "Float",
"label": "Spam Score",
"no_copy": 1,
"precision": "1",
"read_only": 1
},
{
"default": "0",
"depends_on": "eval: doc.is_rejected",
"fieldname": "is_rejected",
"fieldtype": "Check",
"hidden": 1,
"label": "Is Rejected",
"no_copy": 1,
"read_only": 1,
"search_index": 1
},
{
"depends_on": "eval: doc.is_rejected",
"fieldname": "rejection_message",
"fieldtype": "Small Text",
"label": "Rejection Message",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "domain_name",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Domain Name",
"no_copy": 1,
"options": "Mail Domain Registry",
"read_only": 1,
"search_index": 1
},
{
"fieldname": "agent",
"fieldtype": "Link",
"label": "Agent",
"no_copy": 1,
"options": "Mail Agent",
"read_only": 1,
"search_index": 1,
"set_only_once": 1
},
{
"fieldname": "message_id",
"fieldtype": "Data",
"ignore_xss_filter": 1,
"in_standard_filter": 1,
"label": "Message ID",
"no_copy": 1,
"read_only": 1,
"search_index": 1
},
{
"depends_on": "eval: doc.message_size",
"fieldname": "message_size",
"fieldtype": "Int",
"label": "Message Size (Bytes)",
"no_copy": 1,
"non_negative": 1,
"read_only": 1
},
{
"fieldname": "created_at",
"fieldtype": "Datetime",
"label": "Created At",
"no_copy": 1,
"read_only": 1,
"search_index": 1
},
{
"fieldname": "received_at",
"fieldtype": "Datetime",
"label": "Received At",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "processed_at",
"fieldtype": "Datetime",
"label": "Processed At",
"no_copy": 1,
"read_only": 1
},
{
"description": "Received At - Created At",
"fieldname": "received_after",
"fieldtype": "Data",
"label": "Received After (Seconds)",
"no_copy": 1,
"read_only": 1
},
{
"description": "Processed At - Received At",
"fieldname": "processed_after",
"fieldtype": "Data",
"label": "Processed After (Seconds)",
"no_copy": 1,
"read_only": 1
},
{
"default": "0",
"fieldname": "spf",
"fieldtype": "Check",
"label": "SPF",
"no_copy": 1,
"read_only": 1
},
{
"default": "0",
"fieldname": "dkim",
"fieldtype": "Check",
"label": "DKIM",
"no_copy": 1,
"read_only": 1
},
{
"default": "0",
"fieldname": "dmarc",
"fieldtype": "Check",
"label": "DMARC",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "spf_description",
"fieldtype": "Small Text",
"label": "SPF Description",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "dkim_description",
"fieldtype": "Small Text",
"label": "DKIM Description",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "dmarc_description",
"fieldtype": "Small Text",
"label": "DMARC Description",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "message",
"fieldtype": "Code",
"label": "Message",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "column_break_gmtb",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_vjs7",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_ia4p",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_zklh",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_9aty",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_iryz",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_2tlp",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_g31e",
"fieldtype": "Section Break"
},
{
"default": "0",
"depends_on": "eval: doc.is_spam",
"fieldname": "is_spam",
"fieldtype": "Check",
"hidden": 1,
"label": "Is Spam",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "section_break_nmav",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_xy6m",
"fieldtype": "Column Break"
}
],
"in_create": 1,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-10-27 16:36:28.809153",
"modified_by": "Administrator",
"module": "Mail Server",
"name": "Incoming Mail Log",
"naming_rule": "Set by user",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt

import frappe
from frappe.model.document import Document
from uuid_utils import uuid7


class IncomingMailLog(Document):
def autoname(self) -> None:
self.name = str(uuid7())

def validate(self) -> None:
self.validate_status()

def validate_status(self) -> None:
"""Set status to `In Progress` if not set."""

if not self.status:
self.status = "In Progress"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestIncomingMailLog(FrappeTestCase):
pass
Loading

0 comments on commit 1d5d650

Please sign in to comment.