diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0661d0ca..b1c8b90c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: pull_request: concurrency: - group: develop-mail-${{ github.event.number }} + group: develop-mail_client-${{ github.event.number }} cancel-in-progress: true jobs: @@ -91,10 +91,10 @@ jobs: - name: Install working-directory: /home/runner/frappe-bench run: | - bench get-app mail $GITHUB_WORKSPACE + bench get-app mail_client $GITHUB_WORKSPACE bench setup requirements --dev bench new-site --db-root-password root --admin-password admin test_site - bench --site test_site install-app mail + bench --site test_site install-app mail_client bench build env: CI: 'Yes' @@ -103,6 +103,6 @@ jobs: working-directory: /home/runner/frappe-bench run: | bench --site test_site set-config allow_tests true - bench --site test_site run-tests --app mail + bench --site test_site run-tests --app mail_client env: TYPE: server diff --git a/.gitignore b/.gitignore index 57f13221..8a17b484 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,6 @@ tags node_modules __pycache__ -mail/public/frontend -mail/www/mail.html +mail_client/public/frontend +mail_client/www/client.html .vscode \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2dcdd3a..05a3779b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: rev: v4.3.0 hooks: - id: trailing-whitespace - files: "mail.*" + files: "mail_client.*" exclude: ".*json$|.*txt$|.*csv|.*md|.*svg" - id: check-yaml - id: no-commit-to-branch @@ -38,11 +38,11 @@ repos: # Ignore any files that might contain jinja / bundles exclude: | (?x)^( - mail/public/dist/.*| + mail_client/public/dist/.*| .*node_modules.*| .*boilerplate.*| - mail/templates/includes/.*| - mail/public/js/lib/.* + mail_client/templates/includes/.*| + mail_client/public/js/lib/.* )$ @@ -55,12 +55,12 @@ repos: # Ignore any files that might contain jinja / bundles exclude: | (?x)^( - mail/public/dist/.*| + mail_client/public/dist/.*| cypress/.*| .*node_modules.*| .*boilerplate.*| - mail/templates/includes/.*| - mail/public/js/lib/.* + mail_client/templates/includes/.*| + mail_client/public/js/lib/.* )$ ci: diff --git a/README.md b/README.md index f9b94237..de40eb65 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

Frappe Mail

-Frappe Mail is an open-source email platform built on the [Frappe Framework](https://github.com/frappe/frappe), designed to streamline end-to-end email management. It’s organized into three core components [Client](https://github.com/frappe/mail), [Server](https://github.com/frappe/mail_server), and [Agent](https://github.com/frappe/mail_agent). The Client generates email messages and passes them to the Server for processing. The Server handles essential validations, such as checking user quotas, enforcing limits, and running spam checks. If all checks are cleared, the email is pushed to [RabbitMQ](https://github.com/rabbitmq/rabbitmq-server). The Agent then takes over, with multiple agents available to consume emails from the queue and deliver them through a locally connected [Haraka MTA](https://github.com/haraka/haraka) instance. With simple APIs, Frappe Mail makes it easy to integrate reliable email functionality into your applications. +Frappe Mail is an open-source email platform built on the [Frappe Framework](https://github.com/frappe/frappe), designed to streamline end-to-end email management. It’s organized into three core components [Client](https://github.com/frappe/mail_client), [Server](https://github.com/frappe/mail_server), and [Agent](https://github.com/frappe/mail_agent). The Client generates email messages and passes them to the Server for processing. The Server handles essential validations, such as checking user quotas, enforcing limits, and running spam checks. If all checks are cleared, the email is pushed to [RabbitMQ](https://github.com/rabbitmq/rabbitmq-server). The Agent then takes over, with multiple agents available to consume emails from the queue and deliver them through a locally connected [Haraka MTA](https://github.com/haraka/haraka) instance. With simple APIs, Frappe Mail makes it easy to integrate reliable email functionality into your applications. > Note: Frappe Mail Client is designed to work exclusively with the Frappe Mail Server and is not compatible with traditional email servers. @@ -28,16 +28,16 @@ Frappe Mail is an open-source email platform built on the [Frappe Framework](htt You can install this app using the [bench](https://github.com/frappe/bench) CLI: -1. Install Frappe Mail: +1. Install Frappe Mail Client: ```bash - bench get-app mail + bench get-app mail_client ``` -2. Create a site with the mail app: +2. Create a site with the `mail_client` app: ```bash - bench --site sitename.localhost install-app mail + bench --site sitename.localhost install-app mail_client ``` 3. Open the site in the browser: @@ -48,7 +48,7 @@ You can install this app using the [bench](https://github.com/frappe/bench) CLI: ## Connecting to the Mail Server -1. **Open Mail Settings:** In the Frappe Mail Client, navigate to **Mail Settings** to configure the connection to your Mail Server. +1. **Open Mail Client Settings:** In the Frappe Mail Client, navigate to **Mail Client Settings** to configure the connection to your Mail Server. 2. **Add Mail Server Details:** Enter the following details: @@ -151,7 +151,7 @@ Frappe Mail provides three insightful reports to help you analyze email performa ## Receiving Emails -When an email is sent to your registered domains, the Mail Server processes it and transfers it to your Frappe Mail Client after conducting a spam check. The email will be parsed and accepted if the recipient is valid; otherwise, it will be rejected. If the **Send Notification on Reject** option is enabled in the Mail Settings, a notification email will be sent to the sender when their email is rejected. Additionally, rejected emails are automatically deleted to conserve storage space, in accordance with the **Rejected Mail Retention** setting. +When an email is sent to your registered domains, the Mail Server processes it and transfers it to your Frappe Mail Client after conducting a spam check. The email will be parsed and accepted if the recipient is valid; otherwise, it will be rejected. If the **Send Notification on Reject** option is enabled in the Mail Client Settings, a notification email will be sent to the sender when their email is rejected. Additionally, rejected emails are automatically deleted to conserve storage space, in accordance with the **Rejected Mail Retention** setting. ![mail-settings-incoming](docs/screenshots/mail-settings-incoming.png) @@ -389,7 +389,7 @@ These endpoints are for retrieving received emails. This app uses `pre-commit` for code formatting and linting. Please [install pre-commit](https://pre-commit.com/#installation) and enable it for this repository: ```bash -cd apps/mail +cd apps/mail_client pre-commit install ``` @@ -402,4 +402,4 @@ Pre-commit is configured to use the following tools for checking and formatting ## License -[GNU Affero General Public License v3.0](https://github.com/frappe/mail/blob/develop/license.txt) +[GNU Affero General Public License v3.0](https://github.com/frappe/mail_client/blob/develop/license.txt) diff --git a/frontend/index.html b/frontend/index.html index 998f5428..a2b751d4 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ - Frappe UI App + Frappe Mail Client
diff --git a/frontend/package.json b/frontend/package.json index 47b93e9f..cee593a0 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,8 +5,8 @@ "scripts": { "dev": "vite", "serve": "vite preview", - "build": "vite build --base=/assets/mail/frontend/ && yarn copy-html-entry", - "copy-html-entry": "cp ../mail/public/frontend/index.html ../mail/www/mail.html" + "build": "vite build --base=/assets/mail_client/frontend/ && yarn copy-html-entry", + "copy-html-entry": "cp ../mail_client/public/frontend/index.html ../mail_client/www/client.html" }, "dependencies": { "@vueuse/core": "^10.4.1", diff --git a/frontend/src/components/Controls/MultiselectInput.vue b/frontend/src/components/Controls/MultiselectInput.vue index 539909fd..abc8b623 100644 --- a/frontend/src/components/Controls/MultiselectInput.vue +++ b/frontend/src/components/Controls/MultiselectInput.vue @@ -137,7 +137,7 @@ watchDebounced( ) const filterOptions = createResource({ - url: 'mail.api.mail.get_mail_contacts', + url: 'mail_client.api.client.get_mail_contacts', makeParams(values) { return { txt: values.txt, diff --git a/frontend/src/components/MailDetails.vue b/frontend/src/components/MailDetails.vue index 020fc3b1..34e1ba33 100644 --- a/frontend/src/components/MailDetails.vue +++ b/frontend/src/components/MailDetails.vue @@ -115,7 +115,7 @@ const replyDetails = reactive({ }) const mailThread = createResource({ - url: 'mail.api.mail.get_mail_thread', + url: 'mail_client.api.client.get_mail_thread', makeParams(values) { return { name: values?.mailID || props.mailID, diff --git a/frontend/src/components/Modals/SendMail.vue b/frontend/src/components/Modals/SendMail.vue index 71113142..ce35812d 100644 --- a/frontend/src/components/Modals/SendMail.vue +++ b/frontend/src/components/Modals/SendMail.vue @@ -200,7 +200,7 @@ watch(show, () => { }) const sendMail = createResource({ - url: 'mail.api.outbound.send', + url: 'mail_client.api.outbound.send', method: 'POST', makeParams(values) { return { diff --git a/frontend/src/pages/Inbox.vue b/frontend/src/pages/Inbox.vue index 521c16d1..597a40f1 100644 --- a/frontend/src/pages/Inbox.vue +++ b/frontend/src/pages/Inbox.vue @@ -77,7 +77,7 @@ const setCurrentMail = (mail) => { } const incomingMails = createListResource({ - url: 'mail.api.mail.get_incoming_mails', + url: 'mail_client.api.client.get_incoming_mails', doctype: 'Incoming Mail', auto: true, start: mailStart.value, diff --git a/frontend/src/pages/Sent.vue b/frontend/src/pages/Sent.vue index 8d5a73f1..fa766256 100644 --- a/frontend/src/pages/Sent.vue +++ b/frontend/src/pages/Sent.vue @@ -73,7 +73,7 @@ onMounted(() => { }) const outgoingMails = createListResource({ - url: 'mail.api.mail.get_outgoing_mails', + url: 'mail_client.api.client.get_outgoing_mails', doctype: 'Outgoing Mail', auto: true, start: mailStart.value, diff --git a/frontend/src/router.js b/frontend/src/router.js index 83bdd9b6..7dd6c004 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -22,7 +22,7 @@ const routes = [ ] let router = createRouter({ - history: createWebHistory('/mail'), + history: createWebHistory('/client'), routes, }) diff --git a/frontend/src/stores/session.js b/frontend/src/stores/session.js index 8c7c4253..6e9f569a 100644 --- a/frontend/src/stores/session.js +++ b/frontend/src/stores/session.js @@ -44,7 +44,7 @@ export const sessionStore = defineStore('mail-session', () => { }) const branding = createResource({ - url: 'mail.api.mail.get_branding', + url: 'mail_client.api.client.get_branding', cache: 'brand', auto: true, onSuccess(data) { diff --git a/frontend/src/stores/user.js b/frontend/src/stores/user.js index f38e73b8..695a59f4 100644 --- a/frontend/src/stores/user.js +++ b/frontend/src/stores/user.js @@ -4,7 +4,7 @@ import { createResource } from 'frappe-ui' export const userStore = defineStore('mail-users', () => { let userResource = createResource({ - url: 'mail.api.mail.get_user_info', + url: 'mail_client.api.client.get_user_info', onError(error) { if (error && error.exc_type === 'AuthenticationError') { router.push('/login') diff --git a/frontend/src/translation.js b/frontend/src/translation.js index 2ed3e8b0..49a47236 100644 --- a/frontend/src/translation.js +++ b/frontend/src/translation.js @@ -25,7 +25,7 @@ function translate(message) { function fetchTranslations(lang) { createResource({ - url: 'mail.api.mail.get_translations', + url: 'mail_client.api.client.get_translations', cache: 'translations', auto: true, transform: (data) => { diff --git a/frontend/vite.config.js b/frontend/vite.config.js index eceeabcc..4f83577f 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -20,7 +20,7 @@ export default defineConfig({ }, }, build: { - outDir: `../mail/public/frontend`, + outDir: `../mail_client/public/frontend`, emptyOutDir: true, commonjsOptions: { include: [/tailwind.config.js/, /node_modules/], diff --git a/frontend/yarn-error.log b/frontend/yarn-error.log index e41970ac..50b2893f 100644 --- a/frontend/yarn-error.log +++ b/frontend/yarn-error.log @@ -34,8 +34,8 @@ npm manifest: "scripts": { "dev": "vite", "serve": "vite preview", - "build": "vite build --base=/assets/mail/frontend/ && yarn copy-html-entry", - "copy-html-entry": "cp ../mail/public/frontend/index.html ../mail/www/mail.html" + "build": "vite build --base=/assets/mail_client/frontend/ && yarn copy-html-entry", + "copy-html-entry": "cp ../mail_client/public/frontend/index.html ../mail_client/www/client.html" }, "dependencies": { "feather-icons": "^4.28.0", diff --git a/mail/modules.txt b/mail/modules.txt deleted file mode 100644 index d7e89131..00000000 --- a/mail/modules.txt +++ /dev/null @@ -1 +0,0 @@ -Mail \ No newline at end of file diff --git a/mail/__init__.py b/mail_client/__init__.py similarity index 100% rename from mail/__init__.py rename to mail_client/__init__.py diff --git a/mail/api/auth.py b/mail_client/api/auth.py similarity index 90% rename from mail/api/auth.py rename to mail_client/api/auth.py index fe297963..8c98f8ca 100644 --- a/mail/api/auth.py +++ b/mail_client/api/auth.py @@ -1,8 +1,8 @@ import frappe from frappe import _ -from mail.utils.user import has_role, is_mailbox_owner -from mail.utils.validation import ( +from mail_client.utils.user import has_role, is_mailbox_owner +from mail_client.utils.validation import ( validate_mailbox_for_incoming, validate_mailbox_for_outgoing, ) diff --git a/mail/api/mail.py b/mail_client/api/client.py similarity index 100% rename from mail/api/mail.py rename to mail_client/api/client.py diff --git a/mail/api/inbound.py b/mail_client/api/inbound.py similarity index 91% rename from mail/api/inbound.py rename to mail_client/api/inbound.py index dd008480..e9bed6ed 100644 --- a/mail/api/inbound.py +++ b/mail_client/api/inbound.py @@ -7,13 +7,13 @@ from frappe import _ from frappe.utils import cint, convert_utc_to_system_timezone, now -from mail.api.auth import validate_mailbox, validate_user -from mail.mail.doctype.mail_sync_history.mail_sync_history import get_mail_sync_history -from mail.utils import convert_to_utc -from mail.utils.validation import validate_mailbox_for_incoming +from mail_client.api.auth import validate_mailbox, validate_user +from mail_client.mail_client.doctype.mail_sync_history.mail_sync_history import get_mail_sync_history +from mail_client.utils import convert_to_utc +from mail_client.utils.validation import validate_mailbox_for_incoming if TYPE_CHECKING: - from mail.mail.doctype.mail_sync_history.mail_sync_history import MailSyncHistory + from mail_client.mail_client.doctype.mail_sync_history.mail_sync_history import MailSyncHistory @frappe.whitelist(methods=["GET"]) @@ -65,9 +65,9 @@ def pull_raw( def validate_max_sync_limit(limit: int) -> None: - """Validates if the limit is within the maximum limit set in the Mail Settings.""" + """Validates if the limit is within the maximum limit set in the Mail Client Settings.""" - max_sync_limit = cint(frappe.db.get_single_value("Mail Settings", "max_sync_via_api", cache=True)) + max_sync_limit = cint(frappe.db.get_single_value("Mail Client Settings", "max_sync_via_api", cache=True)) if limit > max_sync_limit: frappe.throw(_("Cannot fetch more than {0} emails at a time.").format(max_sync_limit)) diff --git a/mail/api/outbound.py b/mail_client/api/outbound.py similarity index 97% rename from mail/api/outbound.py rename to mail_client/api/outbound.py index 32436d80..2f8d96d5 100644 --- a/mail/api/outbound.py +++ b/mail_client/api/outbound.py @@ -4,7 +4,7 @@ import frappe from frappe import _ -from mail.mail.doctype.outgoing_mail.outgoing_mail import create_outgoing_mail +from mail_client.mail_client.doctype.outgoing_mail.outgoing_mail import create_outgoing_mail @frappe.whitelist(methods=["POST"]) diff --git a/mail/api/track.py b/mail_client/api/track.py similarity index 90% rename from mail/api/track.py rename to mail_client/api/track.py index 27c59ca3..5d7dc5ca 100644 --- a/mail/api/track.py +++ b/mail_client/api/track.py @@ -28,6 +28,6 @@ def open() -> None: ).run() frappe.db.commit() except Exception: - frappe.log_error(title="mail.api.track.open", message=frappe.get_traceback()) + frappe.log_error(title="mail_client.api.track.open", message=frappe.get_traceback()) finally: frappe.response.update(frappe.utils.get_imaginary_pixel_response()) diff --git a/mail/api/webhook.py b/mail_client/api/webhook.py similarity index 87% rename from mail/api/webhook.py rename to mail_client/api/webhook.py index 1ecd3a95..549e5074 100644 --- a/mail/api/webhook.py +++ b/mail_client/api/webhook.py @@ -4,7 +4,7 @@ from frappe import _ from frappe.utils import convert_utc_to_system_timezone, get_datetime -from mail.mail.doctype.incoming_mail.incoming_mail import process_incoming_mail +from mail_client.mail_client.doctype.incoming_mail.incoming_mail import process_incoming_mail @frappe.whitelist(methods=["POST"], allow_guest=True) @@ -40,7 +40,9 @@ def receive_email() -> None: is_spam=data["is_spam"], ) last_synced_at = convert_utc_to_system_timezone(get_datetime(data["processed_at"])) - frappe.db.set_single_value("Mail Settings", "last_synced_at", last_synced_at, update_modified=False) + frappe.db.set_single_value( + "Mail Client Settings", "last_synced_at", last_synced_at, update_modified=False + ) except Exception: error_log = frappe.get_traceback(with_context=False) frappe.log_error(title=f"Receive Email - {data['domain_name']}", message=error_log) diff --git a/mail/config/__init__.py b/mail_client/config/__init__.py similarity index 100% rename from mail/config/__init__.py rename to mail_client/config/__init__.py diff --git a/mail/fixtures/role.json b/mail_client/fixtures/role.json similarity index 100% rename from mail/fixtures/role.json rename to mail_client/fixtures/role.json diff --git a/mail/hooks.py b/mail_client/hooks.py similarity index 56% rename from mail/hooks.py rename to mail_client/hooks.py index edf1484b..000b3dc2 100644 --- a/mail/hooks.py +++ b/mail_client/hooks.py @@ -1,7 +1,7 @@ -app_name = "mail" -app_title = "Mail" +app_name = "mail_client" +app_title = "Mail Client" app_publisher = "Frappe Technologies Pvt. Ltd." -app_description = "Mail" +app_description = "Frappe Mail Client" app_email = "developers@frappe.io" app_license = "agpl-3.0" # required_apps = [] @@ -10,42 +10,42 @@ website_redirects = [ { "source": "/auth/validate", - "target": "/api/method/mail.api.auth.validate", + "target": "/api/method/mail_client.api.auth.validate", "redirect_http_status": 307, }, { "source": "/outbound/send", - "target": "/api/method/mail.api.outbound.send", + "target": "/api/method/mail_client.api.outbound.send", "redirect_http_status": 307, }, { "source": "/outbound/send-raw", - "target": "/api/method/mail.api.outbound.send_raw", + "target": "/api/method/mail_client.api.outbound.send_raw", "redirect_http_status": 307, }, { "source": "/outbound/send-batch", - "target": "/api/method/mail.api.outbound.send_batch", + "target": "/api/method/mail_client.api.outbound.send_batch", "redirect_http_status": 307, }, { "source": "/outbound/send-raw-batch", - "target": "/api/method/mail.api.outbound.send_raw_batch", + "target": "/api/method/mail_client.api.outbound.send_raw_batch", "redirect_http_status": 307, }, { "source": "/outbound/send-newsletter", - "target": "/api/method/mail.api.outbound.send_newsletter", + "target": "/api/method/mail_client.api.outbound.send_newsletter", "redirect_http_status": 307, }, { "source": "/inbound/pull", - "target": "/api/method/mail.api.inbound.pull", + "target": "/api/method/mail_client.api.inbound.pull", "redirect_http_status": 307, }, { "source": "/inbound/pull-raw", - "target": "/api/method/mail.api.inbound.pull_raw", + "target": "/api/method/mail_client.api.inbound.pull_raw", "redirect_http_status": 307, }, ] @@ -55,15 +55,15 @@ # ------------------ # include js, css files in header of desk.html -# app_include_css = "/assets/mail/css/mail.css" -# app_include_js = "/assets/mail/js/mail.js" +# app_include_css = "/assets/mail_client/css/mail_client.css" +# app_include_js = "/assets/mail_client/js/mail_client.js" # include js, css files in header of web template -# web_include_css = "/assets/mail/css/mail.css" -# web_include_js = "/assets/mail/js/mail.js" +# web_include_css = "/assets/mail_client/css/maimail_client.css" +# web_include_js = "/assets/mail_client/js/mail_client.js" # include custom scss in every website theme (without file extension ".scss") -# website_theme_scss = "mail/public/scss/website" +# website_theme_scss = "mail_client/public/scss/website" # include js, css files in header of web form # webform_include_js = {"doctype": "public/js/doctype.js"} @@ -81,7 +81,7 @@ # Svg Icons # ------------------ # include app icons in desk -# app_include_icons = "mail/public/icons.svg" +# app_include_icons = "mail_client/public/icons.svg" # Home Pages # ---------- @@ -105,65 +105,65 @@ # add methods and filters to jinja environment # jinja = { -# "methods": "mail.utils.jinja_methods", -# "filters": "mail.utils.jinja_filters" +# "methods": "mail_client.utils.jinja_methods", +# "filters": "mail_client.utils.jinja_filters" # } # Installation # ------------ -# before_install = "mail.install.before_install" -# after_install = "mail.install.after_install" -# after_migrate = "mail.install.after_migrate" +# before_install = "mail_client.install.before_install" +# after_install = "mail_client.install.after_install" +# after_migrate = "mail_client.install.after_migrate" # Uninstallation # ------------ -# before_uninstall = "mail.uninstall.before_uninstall" -# after_uninstall = "mail.uninstall.after_uninstall" +# before_uninstall = "mail_client.uninstall.before_uninstall" +# after_uninstall = "mail_client.uninstall.after_uninstall" # Integration Setup # ------------------ # To set up dependencies/integrations with other apps # Name of the app being installed is passed as an argument -# before_app_install = "mail.utils.before_app_install" -# after_app_install = "mail.utils.after_app_install" +# before_app_install = "mail_client.utils.before_app_install" +# after_app_install = "mail_client.utils.after_app_install" # Integration Cleanup # ------------------- # To clean up dependencies/integrations with other apps # Name of the app being uninstalled is passed as an argument -# before_app_uninstall = "mail.utils.before_app_uninstall" -# after_app_uninstall = "mail.utils.after_app_uninstall" +# before_app_uninstall = "mail_client.utils.before_app_uninstall" +# after_app_uninstall = "mail_client.utils.after_app_uninstall" # Desk Notifications # ------------------ # See frappe.core.notifications.get_notification_config -# notification_config = "mail.notifications.get_notification_config" +# notification_config = "mail_client.notifications.get_notification_config" # Permissions # ----------- # Permissions evaluated in scripted ways permission_query_conditions = { - "Mailbox": "mail.mail.doctype.mailbox.mailbox.get_permission_query_condition", - "Mail Contact": "mail.mail.doctype.mail_contact.mail_contact.get_permission_query_condition", - "Outgoing Mail": "mail.mail.doctype.outgoing_mail.outgoing_mail.get_permission_query_condition", - "Incoming Mail": "mail.mail.doctype.incoming_mail.incoming_mail.get_permission_query_condition", + "Mailbox": "mail_client.mail_client.doctype.mailbox.mailbox.get_permission_query_condition", + "Mail Contact": "mail_client.mail_client.doctype.mail_contact.mail_contact.get_permission_query_condition", + "Outgoing Mail": "mail_client.mail_client.doctype.outgoing_mail.outgoing_mail.get_permission_query_condition", + "Incoming Mail": "mail_client.mail_client.doctype.incoming_mail.incoming_mail.get_permission_query_condition", } has_permission = { - "Mailbox": "mail.mail.doctype.mailbox.mailbox.has_permission", - "Mail Contact": "mail.mail.doctype.mail_contact.mail_contact.has_permission", - "Outgoing Mail": "mail.mail.doctype.outgoing_mail.outgoing_mail.has_permission", - "Incoming Mail": "mail.mail.doctype.incoming_mail.incoming_mail.has_permission", + "Mailbox": "mail_client.mail_client.doctype.mailbox.mailbox.has_permission", + "Mail Contact": "mail_client.mail_client.doctype.mail_contact.mail_contact.has_permission", + "Outgoing Mail": "mail_client.mail_client.doctype.outgoing_mail.outgoing_mail.has_permission", + "Incoming Mail": "mail_client.mail_client.doctype.incoming_mail.incoming_mail.has_permission", } website_route_rules = [ - {"from_route": "/mail/", "to_route": "mail"}, + {"from_route": "/mail_client/", "to_route": "client"}, ] # DocType Class @@ -180,9 +180,9 @@ doc_events = { "File": { - "validate": "mail.overrides.validate_file", - "on_update": "mail.overrides.validate_file", - "on_trash": "mail.overrides.validate_file", + "validate": "mail_client.overrides.validate_file", + "on_update": "mail_client.overrides.validate_file", + "on_trash": "mail_client.overrides.validate_file", } } @@ -191,28 +191,28 @@ scheduler_events = { # "all": [ - # "mail.tasks.all" + # "mail_client.tasks.all" # ], "daily": [ - "mail.mail.doctype.outgoing_mail.outgoing_mail.delete_newsletters", - "mail.mail.doctype.incoming_mail.incoming_mail.delete_rejected_mails", + "mail_client.mail_client.doctype.outgoing_mail.outgoing_mail.delete_newsletters", + "mail_client.mail_client.doctype.incoming_mail.incoming_mail.delete_rejected_mails", ], # "hourly": [ - # "mail.tasks.hourly" + # "mail_client.tasks.hourly" # ], # "weekly": [ - # "mail.tasks.weekly" + # "mail_client.tasks.weekly" # ], # "monthly": [ - # "mail.tasks.monthly" + # "mail_client.tasks.monthly" # ], "cron": { "* * * * *": [ - "mail.tasks.enqueue_transfer_emails_to_mail_server", + "mail_client.tasks.enqueue_transfer_emails_to_mail_server", ], "*/30 * * * *": [ - "mail.tasks.enqueue_fetch_emails_from_mail_server", - "mail.tasks.enqueue_fetch_and_update_delivery_statuses", + "mail_client.tasks.enqueue_fetch_emails_from_mail_server", + "mail_client.tasks.enqueue_fetch_and_update_delivery_statuses", ], }, } @@ -220,20 +220,20 @@ # Testing # ------- -# before_tests = "mail.install.before_tests" +# before_tests = "mail_client.install.before_tests" # Overriding Methods # ------------------------------ # # override_whitelisted_methods = { -# "frappe.desk.doctype.event.event.get_events": "mail.event.get_events" +# "frappe.desk.doctype.event.event.get_events": "mail_client.event.get_events" # } # # each overriding function accepts a `data` argument; # generated from the base implementation of the doctype dashboard, # along with any modifications made in other Frappe apps # override_doctype_dashboards = { -# "Task": "mail.task.get_dashboard_data" +# "Task": "mail_client.task.get_dashboard_data" # } # exempt linked doctypes from being automatically cancelled @@ -247,13 +247,13 @@ # Request Events # ---------------- -# before_request = ["mail.utils.before_request"] -# after_request = ["mail.utils.after_request"] +# before_request = ["mail_client.utils.before_request"] +# after_request = ["mail_client.utils.after_request"] # Job Events # ---------- -# before_job = ["mail.utils.before_job"] -# after_job = ["mail.utils.after_job"] +# before_job = ["mail_client.utils.before_job"] +# after_job = ["mail_client.utils.after_job"] # User Data Protection # -------------------- @@ -283,7 +283,7 @@ # -------------------------------- # auth_hooks = [ -# "mail.auth.validate" +# "mail_client.auth.validate" # ] # Automatically update python controller files with type annotations for this app. diff --git a/mail/locale/main.pot b/mail_client/locale/main.pot similarity index 98% rename from mail/locale/main.pot rename to mail_client/locale/main.pot index 3721cfe4..d1654fd3 100644 --- a/mail/locale/main.pot +++ b/mail_client/locale/main.pot @@ -33,7 +33,7 @@ msgstr "" msgid "API" msgstr "" -#. Label of the mail_server_api_key (Data) field in DocType 'Mail Settings' +#. Label of the mail_server_api_key (Data) field in DocType 'Mail Client Settings' #: mail/mail/doctype/mail_settings/mail_settings.json msgid "API Key" msgstr "" @@ -548,7 +548,7 @@ msgstr "" msgid "Include Newsletter" msgstr "" -#. Label of the incoming_tab (Tab Break) field in DocType 'Mail Settings' +#. Label of the incoming_tab (Tab Break) field in DocType 'Mail Client Settings' #. Label of the incoming (Check) field in DocType 'Mailbox' #: mail/mail/doctype/mail_settings/mail_settings.json #: mail/mail/doctype/mailbox/mailbox.json @@ -607,7 +607,7 @@ msgstr "" msgid "Last Opened From IP" msgstr "" -#. Label of the last_synced_at (Datetime) field in DocType 'Mail Settings' +#. Label of the last_synced_at (Datetime) field in DocType 'Mail Client Settings' #. Label of the last_synced_at (Datetime) field in DocType 'Mail Sync History' #: mail/mail/doctype/mail_settings/mail_settings.json #: mail/mail/doctype/mail_sync_history/mail_sync_history.json @@ -667,14 +667,14 @@ msgstr "" msgid "Mail Recipient" msgstr "" -#. Label of the mail_server_host (Data) field in DocType 'Mail Settings' +#. Label of the mail_server_host (Data) field in DocType 'Mail Client Settings' #: mail/mail/doctype/mail_settings/mail_settings.json msgid "Mail Server" msgstr "" #. Name of a DocType #: mail/mail/doctype/mail_settings/mail_settings.json -msgid "Mail Settings" +msgid "Mail Client Settings" msgstr "" #. Name of a DocType @@ -739,32 +739,32 @@ msgstr "" msgid "Max Attachment Size (MB)" msgstr "" -#. Label of the outgoing_max_attachments (Int) field in DocType 'Mail Settings' +#. Label of the outgoing_max_attachments (Int) field in DocType 'Mail Client Settings' #: mail/mail/doctype/mail_settings/mail_settings.json msgid "Max Attachments (Count)" msgstr "" -#. Label of the max_headers (Int) field in DocType 'Mail Settings' +#. Label of the max_headers (Int) field in DocType 'Mail Client Settings' #: mail/mail/doctype/mail_settings/mail_settings.json msgid "Max Headers" msgstr "" -#. Label of the max_message_size (Int) field in DocType 'Mail Settings' +#. Label of the max_message_size (Int) field in DocType 'Mail Client Settings' #: mail/mail/doctype/mail_settings/mail_settings.json msgid "Max Message Size (MB)" msgstr "" -#. Label of the max_recipients (Int) field in DocType 'Mail Settings' +#. Label of the max_recipients (Int) field in DocType 'Mail Client Settings' #: mail/mail/doctype/mail_settings/mail_settings.json msgid "Max Recipients" msgstr "" -#. Label of the max_newsletter_retention (Int) field in DocType 'Mail Settings' +#. Label of the max_newsletter_retention (Int) field in DocType 'Mail Client Settings' #: mail/mail/doctype/mail_settings/mail_settings.json msgid "Max Retention (Days)" msgstr "" -#. Label of the max_sync_via_api (Int) field in DocType 'Mail Settings' +#. Label of the max_sync_via_api (Int) field in DocType 'Mail Client Settings' #: mail/mail/doctype/mail_settings/mail_settings.json msgid "Max Sync via API (Count)" msgstr "" @@ -872,7 +872,7 @@ msgstr "" msgid "Outbound Delay" msgstr "" -#. Label of the outgoing_tab (Tab Break) field in DocType 'Mail Settings' +#. Label of the outgoing_tab (Tab Break) field in DocType 'Mail Client Settings' #. Label of the outgoing (Check) field in DocType 'Mailbox' #: mail/mail/doctype/mail_settings/mail_settings.json #: mail/mail/doctype/mailbox/mailbox.json @@ -918,7 +918,7 @@ msgid "Pending" msgstr "" #: mail/mail/doctype/mail_settings/mail_settings.py:65 -msgid "Please set the {0} in the Mail Settings." +msgid "Please set the {0} in the Mail Client Settings." msgstr "" #. Label of the postmaster (Check) field in DocType 'Mailbox' @@ -1023,7 +1023,7 @@ msgstr "" msgid "Rejected" msgstr "" -#. Label of the rejected_mail_retention (Int) field in DocType 'Mail Settings' +#. Label of the rejected_mail_retention (Int) field in DocType 'Mail Client Settings' #: mail/mail/doctype/mail_settings/mail_settings.json msgid "Rejected Mail Retention (Days)" msgstr "" diff --git a/mail/mail/__init__.py b/mail_client/mail_client/__init__.py similarity index 100% rename from mail/mail/__init__.py rename to mail_client/mail_client/__init__.py diff --git a/mail/mail/doctype/__init__.py b/mail_client/mail_client/doctype/__init__.py similarity index 100% rename from mail/mail/doctype/__init__.py rename to mail_client/mail_client/doctype/__init__.py diff --git a/mail/mail/doctype/incoming_mail/__init__.py b/mail_client/mail_client/doctype/incoming_mail/__init__.py similarity index 100% rename from mail/mail/doctype/incoming_mail/__init__.py rename to mail_client/mail_client/doctype/incoming_mail/__init__.py diff --git a/mail/mail/doctype/incoming_mail/incoming_mail.js b/mail_client/mail_client/doctype/incoming_mail/incoming_mail.js similarity index 80% rename from mail/mail/doctype/incoming_mail/incoming_mail.js rename to mail_client/mail_client/doctype/incoming_mail/incoming_mail.js index 4b51e824..1cda6acc 100644 --- a/mail/mail/doctype/incoming_mail/incoming_mail.js +++ b/mail_client/mail_client/doctype/incoming_mail/incoming_mail.js @@ -27,7 +27,7 @@ frappe.ui.form.on("Incoming Mail", { reply(frm) { frappe.model.open_mapped_doc({ - method: "mail.mail.doctype.incoming_mail.incoming_mail.reply_to_mail", + method: "mail_client.mail_client.doctype.incoming_mail.incoming_mail.reply_to_mail", frm: frm, args: { all: false, @@ -37,7 +37,7 @@ frappe.ui.form.on("Incoming Mail", { reply_all(frm) { frappe.model.open_mapped_doc({ - method: "mail.mail.doctype.incoming_mail.incoming_mail.reply_to_mail", + method: "mail_client.mail_client.doctype.incoming_mail.incoming_mail.reply_to_mail", frm: frm, args: { all: true, diff --git a/mail/mail/doctype/incoming_mail/incoming_mail.json b/mail_client/mail_client/doctype/incoming_mail/incoming_mail.json similarity index 99% rename from mail/mail/doctype/incoming_mail/incoming_mail.json rename to mail_client/mail_client/doctype/incoming_mail/incoming_mail.json index 92a9667e..afe3844f 100644 --- a/mail/mail/doctype/incoming_mail/incoming_mail.json +++ b/mail_client/mail_client/doctype/incoming_mail/incoming_mail.json @@ -434,7 +434,7 @@ "links": [], "modified": "2024-11-05 16:31:51.970776", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Incoming Mail", "owner": "Administrator", "permissions": [ diff --git a/mail/mail/doctype/incoming_mail/incoming_mail.py b/mail_client/mail_client/doctype/incoming_mail/incoming_mail.py similarity index 90% rename from mail/mail/doctype/incoming_mail/incoming_mail.py rename to mail_client/mail_client/doctype/incoming_mail/incoming_mail.py index e08fb7c0..537b1f73 100644 --- a/mail/mail/doctype/incoming_mail/incoming_mail.py +++ b/mail_client/mail_client/doctype/incoming_mail/incoming_mail.py @@ -1,7 +1,6 @@ # Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt -import time from email.utils import parseaddr from typing import TYPE_CHECKING @@ -13,16 +12,16 @@ from frappe.utils import now, time_diff_in_seconds from uuid_utils import uuid7 -from mail.mail.doctype.mail_contact.mail_contact import create_mail_contact -from mail.mail.doctype.outgoing_mail.outgoing_mail import create_outgoing_mail -from mail.mail_server import get_mail_server_inbound_api -from mail.utils import add_or_update_tzinfo, get_in_reply_to_mail, parse_iso_datetime -from mail.utils.cache import get_postmaster_for_domain -from mail.utils.email_parser import EmailParser, extract_ip_and_host -from mail.utils.user import get_user_mailboxes, is_mailbox_owner, is_system_manager +from mail_client.mail_client.doctype.mail_contact.mail_contact import create_mail_contact +from mail_client.mail_client.doctype.outgoing_mail.outgoing_mail import create_outgoing_mail +from mail_client.mail_server import get_mail_server_inbound_api +from mail_client.utils import add_or_update_tzinfo, get_in_reply_to_mail, parse_iso_datetime +from mail_client.utils.cache import get_postmaster_for_domain +from mail_client.utils.email_parser import EmailParser, extract_ip_and_host +from mail_client.utils.user import get_user_mailboxes, is_mailbox_owner, is_system_manager if TYPE_CHECKING: - from mail.mail.doctype.outgoing_mail.outgoing_mail import OutgoingMail + from mail_client.mail_client.doctype.outgoing_mail.outgoing_mail import OutgoingMail class IncomingMail(Document): @@ -99,7 +98,7 @@ def send_reject_notification(self) -> None: """Sends a rejection notification to the sender.""" if self.is_rejected and frappe.db.get_single_value( - "Mail Settings", "send_notification_on_reject", cache=True + "Mail Client Settings", "send_notification_on_reject", cache=True ): try: create_outgoing_mail( @@ -202,7 +201,7 @@ def reply_to_mail(source_name, target_doc=None) -> "OutgoingMail": def delete_rejected_mails() -> None: """Called by the scheduler to delete the rejected mails based on the retention.""" - retention_days = frappe.db.get_single_value("Mail Settings", "rejected_mail_retention", cache=True) + retention_days = frappe.db.get_single_value("Mail Client Settings", "rejected_mail_retention", cache=True) IM = frappe.qb.DocType("Incoming Mail") ( frappe.qb.from_(IM) @@ -337,7 +336,7 @@ def fetch_emails_from_mail_server() -> None: try: inbound_api = get_mail_server_inbound_api() - last_synced_at = frappe.db.get_single_value("Mail Settings", "last_synced_at") + last_synced_at = frappe.db.get_single_value("Mail Client Settings", "last_synced_at") if last_synced_at: last_synced_at = add_or_update_tzinfo(last_synced_at) @@ -348,7 +347,7 @@ def fetch_emails_from_mail_server() -> None: process_incoming_mail(mail["incoming_mail_log"], mail["message"], mail["is_spam"]) frappe.db.set_single_value( - "Mail Settings", "last_synced_at", result["last_synced_at"], update_modified=False + "Mail Client Settings", "last_synced_at", result["last_synced_at"], update_modified=False ) except Exception: diff --git a/mail/mail/doctype/incoming_mail/incoming_mail_list.js b/mail_client/mail_client/doctype/incoming_mail/incoming_mail_list.js similarity index 92% rename from mail/mail/doctype/incoming_mail/incoming_mail_list.js rename to mail_client/mail_client/doctype/incoming_mail/incoming_mail_list.js index 59cea55b..09a7458f 100644 --- a/mail/mail/doctype/incoming_mail/incoming_mail_list.js +++ b/mail_client/mail_client/doctype/incoming_mail/incoming_mail_list.js @@ -21,7 +21,7 @@ frappe.listview_settings["Incoming Mail"] = { function fetch_emails_from_mail_server(listview) { frappe.call({ - method: "mail.tasks.enqueue_fetch_emails_from_mail_server", + method: "mail_client.tasks.enqueue_fetch_emails_from_mail_server", freeze: true, freeze_message: __("Creating Job..."), callback: () => { diff --git a/mail/mail/doctype/incoming_mail/test_incoming_mail.py b/mail_client/mail_client/doctype/incoming_mail/test_incoming_mail.py similarity index 100% rename from mail/mail/doctype/incoming_mail/test_incoming_mail.py rename to mail_client/mail_client/doctype/incoming_mail/test_incoming_mail.py diff --git a/mail/mail/doctype/mail_alias/__init__.py b/mail_client/mail_client/doctype/mail_alias/__init__.py similarity index 100% rename from mail/mail/doctype/mail_alias/__init__.py rename to mail_client/mail_client/doctype/mail_alias/__init__.py diff --git a/mail/mail/doctype/mail_alias/mail_alias.js b/mail_client/mail_client/doctype/mail_alias/mail_alias.js similarity index 100% rename from mail/mail/doctype/mail_alias/mail_alias.js rename to mail_client/mail_client/doctype/mail_alias/mail_alias.js diff --git a/mail/mail/doctype/mail_alias/mail_alias.json b/mail_client/mail_client/doctype/mail_alias/mail_alias.json similarity index 98% rename from mail/mail/doctype/mail_alias/mail_alias.json rename to mail_client/mail_client/doctype/mail_alias/mail_alias.json index 2398d9d4..80c58015 100644 --- a/mail/mail/doctype/mail_alias/mail_alias.json +++ b/mail_client/mail_client/doctype/mail_alias/mail_alias.json @@ -67,7 +67,7 @@ "links": [], "modified": "2024-10-21 14:20:19.566926", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Mail Alias", "naming_rule": "Set by user", "owner": "Administrator", diff --git a/mail/mail/doctype/mail_alias/mail_alias.py b/mail_client/mail_client/doctype/mail_alias/mail_alias.py similarity index 96% rename from mail/mail/doctype/mail_alias/mail_alias.py rename to mail_client/mail_client/doctype/mail_alias/mail_alias.py index bd0637c2..2a3f5a9a 100644 --- a/mail/mail/doctype/mail_alias/mail_alias.py +++ b/mail_client/mail_client/doctype/mail_alias/mail_alias.py @@ -5,7 +5,7 @@ from frappe import _ from frappe.model.document import Document -from mail.utils.validation import ( +from mail_client.utils.validation import ( is_valid_email_for_domain, validate_domain_is_enabled_and_verified, validate_mailbox_for_incoming, diff --git a/mail/mail/doctype/mail_alias/test_mail_alias.py b/mail_client/mail_client/doctype/mail_alias/test_mail_alias.py similarity index 100% rename from mail/mail/doctype/mail_alias/test_mail_alias.py rename to mail_client/mail_client/doctype/mail_alias/test_mail_alias.py diff --git a/mail/mail/doctype/mail_alias_mailbox/__init__.py b/mail_client/mail_client/doctype/mail_alias_mailbox/__init__.py similarity index 100% rename from mail/mail/doctype/mail_alias_mailbox/__init__.py rename to mail_client/mail_client/doctype/mail_alias_mailbox/__init__.py diff --git a/mail/mail/doctype/mail_alias_mailbox/mail_alias_mailbox.json b/mail_client/mail_client/doctype/mail_alias_mailbox/mail_alias_mailbox.json similarity index 95% rename from mail/mail/doctype/mail_alias_mailbox/mail_alias_mailbox.json rename to mail_client/mail_client/doctype/mail_alias_mailbox/mail_alias_mailbox.json index a1fe8827..5477e18f 100644 --- a/mail/mail/doctype/mail_alias_mailbox/mail_alias_mailbox.json +++ b/mail_client/mail_client/doctype/mail_alias_mailbox/mail_alias_mailbox.json @@ -22,7 +22,7 @@ "links": [], "modified": "2024-04-07 13:58:27.070251", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Mail Alias Mailbox", "owner": "Administrator", "permissions": [], diff --git a/mail/mail/doctype/mail_alias_mailbox/mail_alias_mailbox.py b/mail_client/mail_client/doctype/mail_alias_mailbox/mail_alias_mailbox.py similarity index 100% rename from mail/mail/doctype/mail_alias_mailbox/mail_alias_mailbox.py rename to mail_client/mail_client/doctype/mail_alias_mailbox/mail_alias_mailbox.py diff --git a/mail/mail/doctype/mail_contact/__init__.py b/mail_client/mail_client/doctype/mail_client_settings/__init__.py similarity index 100% rename from mail/mail/doctype/mail_contact/__init__.py rename to mail_client/mail_client/doctype/mail_client_settings/__init__.py diff --git a/mail/mail/doctype/mail_settings/mail_settings.js b/mail_client/mail_client/doctype/mail_client_settings/mail_client_settings.js similarity index 76% rename from mail/mail/doctype/mail_settings/mail_settings.js rename to mail_client/mail_client/doctype/mail_client_settings/mail_client_settings.js index e858b2f7..c9837616 100644 --- a/mail/mail/doctype/mail_settings/mail_settings.js +++ b/mail_client/mail_client/doctype/mail_client_settings/mail_client_settings.js @@ -1,7 +1,7 @@ // Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt -// frappe.ui.form.on("Mail Settings", { +// frappe.ui.form.on("Mail Client Settings", { // refresh(frm) { // }, diff --git a/mail/mail/doctype/mail_settings/mail_settings.json b/mail_client/mail_client/doctype/mail_client_settings/mail_client_settings.json similarity index 98% rename from mail/mail/doctype/mail_settings/mail_settings.json rename to mail_client/mail_client/doctype/mail_client_settings/mail_client_settings.json index 340b4fe4..46ff58b0 100644 --- a/mail/mail/doctype/mail_settings/mail_settings.json +++ b/mail_client/mail_client/doctype/mail_client_settings/mail_client_settings.json @@ -198,8 +198,8 @@ "links": [], "modified": "2024-11-05 16:00:47.561767", "modified_by": "Administrator", - "module": "Mail", - "name": "Mail Settings", + "module": "Mail Client", + "name": "Mail Client Settings", "owner": "Administrator", "permissions": [ { diff --git a/mail/mail/doctype/mail_settings/mail_settings.py b/mail_client/mail_client/doctype/mail_client_settings/mail_client_settings.py similarity index 76% rename from mail/mail/doctype/mail_settings/mail_settings.py rename to mail_client/mail_client/doctype/mail_client_settings/mail_client_settings.py index 5e2fa60f..6b4dd5ad 100644 --- a/mail/mail/doctype/mail_settings/mail_settings.py +++ b/mail_client/mail_client/doctype/mail_client_settings/mail_client_settings.py @@ -7,10 +7,10 @@ from frappe.model.document import Document from frappe.utils import cint -from mail.mail_server import MailServerAuthAPI +from mail_client.mail_server import MailServerAuthAPI -class MailSettings(Document): +class MailClientSettings(Document): def validate(self) -> None: self.validate_mail_server() self.validate_outgoing_max_attachment_size() @@ -49,10 +49,10 @@ def validate_outgoing_total_attachments_size(self) -> None: ) -def validate_mail_settings() -> None: - """Validates the mandatory fields in the Mail Settings.""" +def validate_mail_client_settings() -> None: + """Validates the mandatory fields in the Mail Client Settings.""" - mail_settings = frappe.get_doc("Mail Settings") + client_settings = frappe.get_doc("Mail Client Settings") mandatory_fields = [ "mail_server_host", "mail_server_api_key", @@ -60,6 +60,8 @@ def validate_mail_settings() -> None: ] for field in mandatory_fields: - if not mail_settings.get(field): - field_label = frappe.get_meta("Mail Settings").get_label(field) - frappe.throw(_("Please set the {0} in the Mail Settings.").format(frappe.bold(field_label))) + if not client_settings.get(field): + field_label = frappe.get_meta("Mail Client Settings").get_label(field) + frappe.throw( + _("Please set the {0} in the Mail Client Settings.").format(frappe.bold(field_label)) + ) diff --git a/mail/mail/doctype/mail_settings/test_mail_settings.py b/mail_client/mail_client/doctype/mail_client_settings/test_mail_client_settings.py similarity index 77% rename from mail/mail/doctype/mail_settings/test_mail_settings.py rename to mail_client/mail_client/doctype/mail_client_settings/test_mail_client_settings.py index 66cd65dc..75661fd6 100644 --- a/mail/mail/doctype/mail_settings/test_mail_settings.py +++ b/mail_client/mail_client/doctype/mail_client_settings/test_mail_client_settings.py @@ -5,5 +5,5 @@ from frappe.tests.utils import FrappeTestCase -class TestMailSettings(FrappeTestCase): +class TestMailClientSettings(FrappeTestCase): pass diff --git a/mail/mail/doctype/mail_domain/__init__.py b/mail_client/mail_client/doctype/mail_contact/__init__.py similarity index 100% rename from mail/mail/doctype/mail_domain/__init__.py rename to mail_client/mail_client/doctype/mail_contact/__init__.py diff --git a/mail/mail/doctype/mail_contact/mail_contact.js b/mail_client/mail_client/doctype/mail_contact/mail_contact.js similarity index 100% rename from mail/mail/doctype/mail_contact/mail_contact.js rename to mail_client/mail_client/doctype/mail_contact/mail_contact.js diff --git a/mail/mail/doctype/mail_contact/mail_contact.json b/mail_client/mail_client/doctype/mail_contact/mail_contact.json similarity index 98% rename from mail/mail/doctype/mail_contact/mail_contact.json rename to mail_client/mail_client/doctype/mail_contact/mail_contact.json index 177e770c..b47206b1 100644 --- a/mail/mail/doctype/mail_contact/mail_contact.json +++ b/mail_client/mail_client/doctype/mail_contact/mail_contact.json @@ -51,7 +51,7 @@ "links": [], "modified": "2024-10-21 15:39:39.869636", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Mail Contact", "naming_rule": "Random", "owner": "Administrator", diff --git a/mail/mail/doctype/mail_contact/mail_contact.py b/mail_client/mail_client/doctype/mail_contact/mail_contact.py similarity index 97% rename from mail/mail/doctype/mail_contact/mail_contact.py rename to mail_client/mail_client/doctype/mail_contact/mail_contact.py index b35fdd4f..4bfa38c5 100644 --- a/mail/mail/doctype/mail_contact/mail_contact.py +++ b/mail_client/mail_client/doctype/mail_contact/mail_contact.py @@ -5,7 +5,7 @@ from frappe import _ from frappe.model.document import Document -from mail.utils.user import is_system_manager +from mail_client.utils.user import is_system_manager class MailContact(Document): diff --git a/mail/mail/doctype/mail_contact/test_mail_contact.py b/mail_client/mail_client/doctype/mail_contact/test_mail_contact.py similarity index 100% rename from mail/mail/doctype/mail_contact/test_mail_contact.py rename to mail_client/mail_client/doctype/mail_contact/test_mail_contact.py diff --git a/mail/mail/doctype/mail_domain_dns_record/__init__.py b/mail_client/mail_client/doctype/mail_domain/__init__.py similarity index 100% rename from mail/mail/doctype/mail_domain_dns_record/__init__.py rename to mail_client/mail_client/doctype/mail_domain/__init__.py diff --git a/mail/mail/doctype/mail_domain/mail_domain.js b/mail_client/mail_client/doctype/mail_domain/mail_domain.js similarity index 100% rename from mail/mail/doctype/mail_domain/mail_domain.js rename to mail_client/mail_client/doctype/mail_domain/mail_domain.js diff --git a/mail/mail/doctype/mail_domain/mail_domain.json b/mail_client/mail_client/doctype/mail_domain/mail_domain.json similarity index 99% rename from mail/mail/doctype/mail_domain/mail_domain.json rename to mail_client/mail_client/doctype/mail_domain/mail_domain.json index 7edd4bb1..e3d9b694 100644 --- a/mail/mail/doctype/mail_domain/mail_domain.json +++ b/mail_client/mail_client/doctype/mail_domain/mail_domain.json @@ -137,7 +137,7 @@ ], "modified": "2024-11-05 15:46:59.592782", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Mail Domain", "naming_rule": "Set by user", "owner": "Administrator", diff --git a/mail/mail/doctype/mail_domain/mail_domain.py b/mail_client/mail_client/doctype/mail_domain/mail_domain.py similarity index 89% rename from mail/mail/doctype/mail_domain/mail_domain.py rename to mail_client/mail_client/doctype/mail_domain/mail_domain.py index 23a33b32..5c0aed5c 100644 --- a/mail/mail/doctype/mail_domain/mail_domain.py +++ b/mail_client/mail_client/doctype/mail_domain/mail_domain.py @@ -5,8 +5,8 @@ from frappe import _ from frappe.model.document import Document -from mail.mail.doctype.mailbox.mailbox import create_postmaster_mailbox -from mail.mail_server import get_mail_server_domain_api +from mail_client.mail_client.doctype.mailbox.mailbox import create_postmaster_mailbox +from mail_client.mail_server import get_mail_server_domain_api class MailDomain(Document): @@ -34,7 +34,7 @@ def validate_newsletter_retention(self) -> None: frappe.throw(_("Newsletter Retention must be greater than 0.")) max_newsletter_retention = frappe.db.get_single_value( - "Mail Settings", "max_newsletter_retention", cache=True + "Mail Client Settings", "max_newsletter_retention", cache=True ) if self.newsletter_retention > max_newsletter_retention: frappe.throw( @@ -44,7 +44,7 @@ def validate_newsletter_retention(self) -> None: ) else: self.newsletter_retention = frappe.db.get_single_value( - "Mail Settings", "default_newsletter_retention", cache=True + "Mail Client Settings", "default_newsletter_retention", cache=True ) def add_or_update_domain_in_mail_server(self) -> None: diff --git a/mail/mail/doctype/mail_domain/test_mail_domain.py b/mail_client/mail_client/doctype/mail_domain/test_mail_domain.py similarity index 100% rename from mail/mail/doctype/mail_domain/test_mail_domain.py rename to mail_client/mail_client/doctype/mail_domain/test_mail_domain.py diff --git a/mail/mail/doctype/mail_header/__init__.py b/mail_client/mail_client/doctype/mail_domain_dns_record/__init__.py similarity index 100% rename from mail/mail/doctype/mail_header/__init__.py rename to mail_client/mail_client/doctype/mail_domain_dns_record/__init__.py diff --git a/mail/mail/doctype/mail_domain_dns_record/mail_domain_dns_record.json b/mail_client/mail_client/doctype/mail_domain_dns_record/mail_domain_dns_record.json similarity index 98% rename from mail/mail/doctype/mail_domain_dns_record/mail_domain_dns_record.json rename to mail_client/mail_client/doctype/mail_domain_dns_record/mail_domain_dns_record.json index d88f1224..b1248d6a 100644 --- a/mail/mail/doctype/mail_domain_dns_record/mail_domain_dns_record.json +++ b/mail_client/mail_client/doctype/mail_domain_dns_record/mail_domain_dns_record.json @@ -83,7 +83,7 @@ "links": [], "modified": "2024-10-20 12:54:06.849443", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Mail Domain DNS Record", "owner": "Administrator", "permissions": [], diff --git a/mail/mail/doctype/mail_domain_dns_record/mail_domain_dns_record.py b/mail_client/mail_client/doctype/mail_domain_dns_record/mail_domain_dns_record.py similarity index 100% rename from mail/mail/doctype/mail_domain_dns_record/mail_domain_dns_record.py rename to mail_client/mail_client/doctype/mail_domain_dns_record/mail_domain_dns_record.py diff --git a/mail/mail/doctype/mail_recipient/__init__.py b/mail_client/mail_client/doctype/mail_header/__init__.py similarity index 100% rename from mail/mail/doctype/mail_recipient/__init__.py rename to mail_client/mail_client/doctype/mail_header/__init__.py diff --git a/mail/mail/doctype/mail_header/mail_header.json b/mail_client/mail_client/doctype/mail_header/mail_header.json similarity index 96% rename from mail/mail/doctype/mail_header/mail_header.json rename to mail_client/mail_client/doctype/mail_header/mail_header.json index 65cee809..8e60e144 100644 --- a/mail/mail/doctype/mail_header/mail_header.json +++ b/mail_client/mail_client/doctype/mail_header/mail_header.json @@ -35,7 +35,7 @@ "links": [], "modified": "2024-05-30 11:19:00.360587", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Mail Header", "owner": "Administrator", "permissions": [], diff --git a/mail/mail/doctype/mail_header/mail_header.py b/mail_client/mail_client/doctype/mail_header/mail_header.py similarity index 100% rename from mail/mail/doctype/mail_header/mail_header.py rename to mail_client/mail_client/doctype/mail_header/mail_header.py diff --git a/mail/mail/doctype/mail_settings/__init__.py b/mail_client/mail_client/doctype/mail_recipient/__init__.py similarity index 100% rename from mail/mail/doctype/mail_settings/__init__.py rename to mail_client/mail_client/doctype/mail_recipient/__init__.py diff --git a/mail/mail/doctype/mail_recipient/mail_recipient.json b/mail_client/mail_client/doctype/mail_recipient/mail_recipient.json similarity index 98% rename from mail/mail/doctype/mail_recipient/mail_recipient.json rename to mail_client/mail_client/doctype/mail_recipient/mail_recipient.json index 18c48d1d..9ca98aa3 100644 --- a/mail/mail/doctype/mail_recipient/mail_recipient.json +++ b/mail_client/mail_client/doctype/mail_recipient/mail_recipient.json @@ -97,7 +97,7 @@ "links": [], "modified": "2024-10-26 11:14:20.285232", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Mail Recipient", "owner": "Administrator", "permissions": [], diff --git a/mail/mail/doctype/mail_recipient/mail_recipient.py b/mail_client/mail_client/doctype/mail_recipient/mail_recipient.py similarity index 100% rename from mail/mail/doctype/mail_recipient/mail_recipient.py rename to mail_client/mail_client/doctype/mail_recipient/mail_recipient.py diff --git a/mail/mail/doctype/mail_sync_history/__init__.py b/mail_client/mail_client/doctype/mail_sync_history/__init__.py similarity index 100% rename from mail/mail/doctype/mail_sync_history/__init__.py rename to mail_client/mail_client/doctype/mail_sync_history/__init__.py diff --git a/mail/mail/doctype/mail_sync_history/mail_sync_history.js b/mail_client/mail_client/doctype/mail_sync_history/mail_sync_history.js similarity index 100% rename from mail/mail/doctype/mail_sync_history/mail_sync_history.js rename to mail_client/mail_client/doctype/mail_sync_history/mail_sync_history.js diff --git a/mail/mail/doctype/mail_sync_history/mail_sync_history.json b/mail_client/mail_client/doctype/mail_sync_history/mail_sync_history.json similarity index 98% rename from mail/mail/doctype/mail_sync_history/mail_sync_history.json rename to mail_client/mail_client/doctype/mail_sync_history/mail_sync_history.json index 07428c69..a601cef1 100644 --- a/mail/mail/doctype/mail_sync_history/mail_sync_history.json +++ b/mail_client/mail_client/doctype/mail_sync_history/mail_sync_history.json @@ -60,7 +60,7 @@ "links": [], "modified": "2024-08-12 12:17:37.936534", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Mail Sync History", "naming_rule": "Random", "owner": "Administrator", diff --git a/mail/mail/doctype/mail_sync_history/mail_sync_history.py b/mail_client/mail_client/doctype/mail_sync_history/mail_sync_history.py similarity index 100% rename from mail/mail/doctype/mail_sync_history/mail_sync_history.py rename to mail_client/mail_client/doctype/mail_sync_history/mail_sync_history.py diff --git a/mail/mail/doctype/mail_sync_history/test_mail_sync_history.py b/mail_client/mail_client/doctype/mail_sync_history/test_mail_sync_history.py similarity index 100% rename from mail/mail/doctype/mail_sync_history/test_mail_sync_history.py rename to mail_client/mail_client/doctype/mail_sync_history/test_mail_sync_history.py diff --git a/mail/mail/doctype/mailbox/__init__.py b/mail_client/mail_client/doctype/mailbox/__init__.py similarity index 100% rename from mail/mail/doctype/mailbox/__init__.py rename to mail_client/mail_client/doctype/mailbox/__init__.py diff --git a/mail/mail/doctype/mailbox/mailbox.js b/mail_client/mail_client/doctype/mailbox/mailbox.js similarity index 85% rename from mail/mail/doctype/mailbox/mailbox.js rename to mail_client/mail_client/doctype/mailbox/mailbox.js index ebb0dfb4..9180d213 100644 --- a/mail/mail/doctype/mailbox/mailbox.js +++ b/mail_client/mail_client/doctype/mailbox/mailbox.js @@ -19,7 +19,7 @@ frappe.ui.form.on("Mailbox", { })); frm.set_query("user", () => ({ - query: "mail.utils.query.get_users_with_mailbox_user_role", + query: "mail_client.utils.query.get_users_with_mailbox_user_role", filters: { enabled: 1, role: "Mailbox User", @@ -57,7 +57,7 @@ frappe.ui.form.on("Mailbox", { delete_incoming_mails(frm) { frappe.call({ - method: "mail.mail.doctype.mailbox.mailbox.delete_incoming_mails", + method: "mail_client.mail_client.doctype.mailbox.mailbox.delete_incoming_mails", args: { mailbox: frm.doc.name, }, @@ -68,7 +68,7 @@ frappe.ui.form.on("Mailbox", { delete_outgoing_mails(frm) { frappe.call({ - method: "mail.mail.doctype.mailbox.mailbox.delete_outgoing_mails", + method: "mail_client.mail_client.doctype.mailbox.mailbox.delete_outgoing_mails", args: { mailbox: frm.doc.name, }, diff --git a/mail/mail/doctype/mailbox/mailbox.json b/mail_client/mail_client/doctype/mailbox/mailbox.json similarity index 99% rename from mail/mail/doctype/mailbox/mailbox.json rename to mail_client/mail_client/doctype/mailbox/mailbox.json index 99af8701..a7d69eb8 100644 --- a/mail/mail/doctype/mailbox/mailbox.json +++ b/mail_client/mail_client/doctype/mailbox/mailbox.json @@ -173,7 +173,7 @@ ], "modified": "2024-11-03 13:10:51.681776", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Mailbox", "naming_rule": "Set by user", "owner": "Administrator", diff --git a/mail/mail/doctype/mailbox/mailbox.py b/mail_client/mail_client/doctype/mailbox/mailbox.py similarity index 97% rename from mail/mail/doctype/mailbox/mailbox.py rename to mail_client/mail_client/doctype/mailbox/mailbox.py index 5b87a57c..f287ccda 100644 --- a/mail/mail/doctype/mailbox/mailbox.py +++ b/mail_client/mail_client/doctype/mailbox/mailbox.py @@ -5,9 +5,9 @@ from frappe import _ from frappe.model.document import Document -from mail.utils.cache import delete_cache -from mail.utils.user import has_role, is_system_manager -from mail.utils.validation import ( +from mail_client.utils.cache import delete_cache +from mail_client.utils.user import has_role, is_system_manager +from mail_client.utils.validation import ( is_valid_email_for_domain, validate_domain_is_enabled_and_verified, ) diff --git a/mail/mail/doctype/mailbox/test_mailbox.py b/mail_client/mail_client/doctype/mailbox/test_mailbox.py similarity index 100% rename from mail/mail/doctype/mailbox/test_mailbox.py rename to mail_client/mail_client/doctype/mailbox/test_mailbox.py diff --git a/mail/mail/doctype/outgoing_mail/__init__.py b/mail_client/mail_client/doctype/outgoing_mail/__init__.py similarity index 100% rename from mail/mail/doctype/outgoing_mail/__init__.py rename to mail_client/mail_client/doctype/outgoing_mail/__init__.py diff --git a/mail/mail/doctype/outgoing_mail/outgoing_mail.js b/mail_client/mail_client/doctype/outgoing_mail/outgoing_mail.js similarity index 87% rename from mail/mail/doctype/outgoing_mail/outgoing_mail.js rename to mail_client/mail_client/doctype/outgoing_mail/outgoing_mail.js index cfc19137..8e92c311 100644 --- a/mail/mail/doctype/outgoing_mail/outgoing_mail.js +++ b/mail_client/mail_client/doctype/outgoing_mail/outgoing_mail.js @@ -14,7 +14,7 @@ frappe.ui.form.on("Outgoing Mail", { set_queries(frm) { frm.set_query("sender", () => ({ - query: "mail.utils.query.get_sender", + query: "mail_client.utils.query.get_sender", })); }, @@ -72,7 +72,7 @@ frappe.ui.form.on("Outgoing Mail", { set_sender(frm) { if (!frm.doc.sender) { frappe.call({ - method: "mail.mail.doctype.outgoing_mail.outgoing_mail.get_default_sender", + method: "mail_client.mail_client.doctype.outgoing_mail.outgoing_mail.get_default_sender", callback: (r) => { if (r.message) { frm.set_value("sender", r.message); @@ -112,7 +112,7 @@ frappe.ui.form.on("Outgoing Mail", { fetch_and_update_delivery_statuses(frm) { frappe.call({ - method: "mail.tasks.enqueue_fetch_and_update_delivery_statuses", + method: "mail_client.tasks.enqueue_fetch_and_update_delivery_statuses", freeze: true, freeze_message: __("Creating Job..."), callback: () => { @@ -128,7 +128,7 @@ frappe.ui.form.on("Outgoing Mail", { reply(frm) { frappe.model.open_mapped_doc({ - method: "mail.mail.doctype.outgoing_mail.outgoing_mail.reply_to_mail", + method: "mail_client.mail_client.doctype.outgoing_mail.outgoing_mail.reply_to_mail", frm: frm, args: { all: false, @@ -138,7 +138,7 @@ frappe.ui.form.on("Outgoing Mail", { reply_all(frm) { frappe.model.open_mapped_doc({ - method: "mail.mail.doctype.outgoing_mail.outgoing_mail.reply_to_mail", + method: "mail_client.mail_client.doctype.outgoing_mail.outgoing_mail.reply_to_mail", frm: frm, args: { all: true, diff --git a/mail/mail/doctype/outgoing_mail/outgoing_mail.json b/mail_client/mail_client/doctype/outgoing_mail/outgoing_mail.json similarity index 99% rename from mail/mail/doctype/outgoing_mail/outgoing_mail.json rename to mail_client/mail_client/doctype/outgoing_mail/outgoing_mail.json index 242527b4..443fd529 100644 --- a/mail/mail/doctype/outgoing_mail/outgoing_mail.json +++ b/mail_client/mail_client/doctype/outgoing_mail/outgoing_mail.json @@ -463,7 +463,7 @@ "links": [], "modified": "2024-11-05 08:56:43.928769", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Outgoing Mail", "owner": "Administrator", "permissions": [ diff --git a/mail/mail/doctype/outgoing_mail/outgoing_mail.py b/mail_client/mail_client/doctype/outgoing_mail/outgoing_mail.py similarity index 96% rename from mail/mail/doctype/outgoing_mail/outgoing_mail.py rename to mail_client/mail_client/doctype/outgoing_mail/outgoing_mail.py index 40c4e920..dcb64f1a 100644 --- a/mail/mail/doctype/outgoing_mail/outgoing_mail.py +++ b/mail_client/mail_client/doctype/outgoing_mail/outgoing_mail.py @@ -34,18 +34,18 @@ from frappe.utils.file_manager import save_file from uuid_utils import uuid7 -from mail.mail.doctype.mail_contact.mail_contact import create_mail_contact -from mail.mail_server import get_mail_server_outbound_api -from mail.utils import ( +from mail_client.mail_client.doctype.mail_contact.mail_contact import create_mail_contact +from mail_client.mail_server import get_mail_server_outbound_api +from mail_client.utils import ( convert_html_to_text, get_in_reply_to, get_in_reply_to_mail, parsedate_to_datetime, ) -from mail.utils.cache import get_user_default_mailbox -from mail.utils.email_parser import EmailParser -from mail.utils.user import get_user_mailboxes, is_mailbox_owner, is_system_manager -from mail.utils.validation import validate_mailbox_for_outgoing +from mail_client.utils.cache import get_user_default_mailbox +from mail_client.utils.email_parser import EmailParser +from mail_client.utils.user import get_user_mailboxes, is_mailbox_owner, is_system_manager +from mail_client.utils.validation import validate_mailbox_for_outgoing class OutgoingMail(Document): @@ -122,7 +122,7 @@ def load_runtime(self) -> None: self.runtime = frappe._dict() self.runtime.mailbox = frappe.get_cached_doc("Mailbox", self.sender) self.runtime.mail_domain = frappe.get_cached_doc("Mail Domain", self.domain_name) - self.runtime.mail_settings = frappe.get_cached_doc("Mail Settings") + self.runtime.client_settings = frappe.get_cached_doc("Mail Client Settings") def validate_domain(self) -> None: """Validates the domain.""" @@ -171,7 +171,7 @@ def validate_in_reply_to(self) -> None: def validate_recipients(self) -> None: """Validates the recipients.""" - max_recipients = self.runtime.mail_settings.max_recipients + max_recipients = self.runtime.client_settings.max_recipients if len(self.recipients) > max_recipients: frappe.throw( _("Recipient limit exceeded ({0}). Maximum {1} recipient(s) allowed.").format( @@ -203,7 +203,7 @@ def validate_custom_headers(self) -> None: """Validates the custom headers.""" if self.custom_headers: - max_headers = self.runtime.mail_settings.max_headers + max_headers = self.runtime.client_settings.max_headers if len(self.custom_headers) > max_headers: frappe.throw( _("Custom Headers limit exceeded ({0}). Maximum {1} custom header(s) allowed.").format( @@ -245,9 +245,9 @@ def validate_attachments(self) -> None: """Validates the attachments.""" if self.attachments: - max_attachments = self.runtime.mail_settings.outgoing_max_attachments - max_attachment_size = self.runtime.mail_settings.outgoing_max_attachment_size - max_attachments_size = self.runtime.mail_settings.outgoing_total_attachments_size + max_attachments = self.runtime.client_settings.outgoing_max_attachments + max_attachment_size = self.runtime.client_settings.outgoing_max_attachment_size + max_attachments_size = self.runtime.client_settings.outgoing_total_attachments_size if len(self.attachments) > max_attachments: frappe.throw( @@ -456,7 +456,7 @@ def validate_max_message_size(self) -> None: """Validates the maximum message size.""" message_size = flt(self.message_size / 1024 / 1024, 3) - max_message_size = self.runtime.mail_settings.max_message_size + max_message_size = self.runtime.client_settings.max_message_size if message_size > max_message_size: frappe.throw( diff --git a/mail/mail/doctype/outgoing_mail/outgoing_mail_list.js b/mail_client/mail_client/doctype/outgoing_mail/outgoing_mail_list.js similarity index 100% rename from mail/mail/doctype/outgoing_mail/outgoing_mail_list.js rename to mail_client/mail_client/doctype/outgoing_mail/outgoing_mail_list.js diff --git a/mail/mail/doctype/outgoing_mail/test_outgoing_mail.py b/mail_client/mail_client/doctype/outgoing_mail/test_outgoing_mail.py similarity index 100% rename from mail/mail/doctype/outgoing_mail/test_outgoing_mail.py rename to mail_client/mail_client/doctype/outgoing_mail/test_outgoing_mail.py diff --git a/mail/mail/report/__init__.py b/mail_client/mail_client/report/__init__.py similarity index 100% rename from mail/mail/report/__init__.py rename to mail_client/mail_client/report/__init__.py diff --git a/mail/mail/report/mail_tracker/__init__.py b/mail_client/mail_client/report/mail_tracker/__init__.py similarity index 100% rename from mail/mail/report/mail_tracker/__init__.py rename to mail_client/mail_client/report/mail_tracker/__init__.py diff --git a/mail/mail/report/mail_tracker/mail_tracker.js b/mail_client/mail_client/report/mail_tracker/mail_tracker.js similarity index 95% rename from mail/mail/report/mail_tracker/mail_tracker.js rename to mail_client/mail_client/report/mail_tracker/mail_tracker.js index ba47f2c8..0a0dd602 100644 --- a/mail/mail/report/mail_tracker/mail_tracker.js +++ b/mail_client/mail_client/report/mail_tracker/mail_tracker.js @@ -24,7 +24,7 @@ frappe.query_reports["Mail Tracker"] = { options: "Outgoing Mail", get_query: () => { return { - query: "mail.utils.query.get_outgoing_mails", + query: "mail_client.utils.query.get_outgoing_mails", }; }, }, diff --git a/mail/mail/report/mail_tracker/mail_tracker.json b/mail_client/mail_client/report/mail_tracker/mail_tracker.json similarity index 95% rename from mail/mail/report/mail_tracker/mail_tracker.json rename to mail_client/mail_client/report/mail_tracker/mail_tracker.json index 9ba61965..792fa136 100644 --- a/mail/mail/report/mail_tracker/mail_tracker.json +++ b/mail_client/mail_client/report/mail_tracker/mail_tracker.json @@ -11,7 +11,7 @@ "letterhead": null, "modified": "2024-05-17 09:38:31.590692", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Mail Tracker", "owner": "Administrator", "prepared_report": 0, diff --git a/mail/mail/report/mail_tracker/mail_tracker.py b/mail_client/mail_client/report/mail_tracker/mail_tracker.py similarity index 97% rename from mail/mail/report/mail_tracker/mail_tracker.py rename to mail_client/mail_client/report/mail_tracker/mail_tracker.py index fe8c4d78..12ca4742 100644 --- a/mail/mail/report/mail_tracker/mail_tracker.py +++ b/mail_client/mail_client/report/mail_tracker/mail_tracker.py @@ -6,7 +6,7 @@ from frappe.query_builder import Criterion, Order from frappe.query_builder.functions import Date -from mail.utils.user import get_user_mailboxes, has_role, is_system_manager +from mail_client.utils.user import get_user_mailboxes, has_role, is_system_manager def execute(filters: dict | None = None) -> tuple: diff --git a/mail/mail/report/outbound_delay/__init__.py b/mail_client/mail_client/report/outbound_delay/__init__.py similarity index 100% rename from mail/mail/report/outbound_delay/__init__.py rename to mail_client/mail_client/report/outbound_delay/__init__.py diff --git a/mail/mail/report/outbound_delay/outbound_delay.js b/mail_client/mail_client/report/outbound_delay/outbound_delay.js similarity index 95% rename from mail/mail/report/outbound_delay/outbound_delay.js rename to mail_client/mail_client/report/outbound_delay/outbound_delay.js index eeca9cf5..36037931 100644 --- a/mail/mail/report/outbound_delay/outbound_delay.js +++ b/mail_client/mail_client/report/outbound_delay/outbound_delay.js @@ -24,7 +24,7 @@ frappe.query_reports["Outbound Delay"] = { options: "Outgoing Mail", get_query: () => { return { - query: "mail.utils.query.get_outgoing_mails", + query: "mail_client.utils.query.get_outgoing_mails", }; }, }, diff --git a/mail/mail/report/outbound_delay/outbound_delay.json b/mail_client/mail_client/report/outbound_delay/outbound_delay.json similarity index 95% rename from mail/mail/report/outbound_delay/outbound_delay.json rename to mail_client/mail_client/report/outbound_delay/outbound_delay.json index fe3a2f77..5ea17799 100644 --- a/mail/mail/report/outbound_delay/outbound_delay.json +++ b/mail_client/mail_client/report/outbound_delay/outbound_delay.json @@ -11,7 +11,7 @@ "letterhead": null, "modified": "2024-10-19 16:50:25.069010", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Outbound Delay", "owner": "Administrator", "prepared_report": 0, diff --git a/mail/mail/report/outbound_delay/outbound_delay.py b/mail_client/mail_client/report/outbound_delay/outbound_delay.py similarity index 98% rename from mail/mail/report/outbound_delay/outbound_delay.py rename to mail_client/mail_client/report/outbound_delay/outbound_delay.py index be4eeb04..706b0b0b 100644 --- a/mail/mail/report/outbound_delay/outbound_delay.py +++ b/mail_client/mail_client/report/outbound_delay/outbound_delay.py @@ -8,7 +8,7 @@ from frappe.query_builder.functions import Date, IfNull from frappe.utils import flt -from mail.utils.user import get_user_mailboxes, has_role, is_system_manager +from mail_client.utils.user import get_user_mailboxes, has_role, is_system_manager def execute(filters: dict | None = None) -> tuple[list, list]: diff --git a/mail/mail/report/outgoing_mail_summary/__init__.py b/mail_client/mail_client/report/outgoing_mail_summary/__init__.py similarity index 100% rename from mail/mail/report/outgoing_mail_summary/__init__.py rename to mail_client/mail_client/report/outgoing_mail_summary/__init__.py diff --git a/mail/mail/report/outgoing_mail_summary/outgoing_mail_summary.js b/mail_client/mail_client/report/outgoing_mail_summary/outgoing_mail_summary.js similarity index 96% rename from mail/mail/report/outgoing_mail_summary/outgoing_mail_summary.js rename to mail_client/mail_client/report/outgoing_mail_summary/outgoing_mail_summary.js index d054e5c8..26149483 100644 --- a/mail/mail/report/outgoing_mail_summary/outgoing_mail_summary.js +++ b/mail_client/mail_client/report/outgoing_mail_summary/outgoing_mail_summary.js @@ -24,7 +24,7 @@ frappe.query_reports["Outgoing Mail Summary"] = { options: "Outgoing Mail", get_query: () => { return { - query: "mail.utils.query.get_outgoing_mails", + query: "mail_client.utils.query.get_outgoing_mails", }; }, }, diff --git a/mail/mail/report/outgoing_mail_summary/outgoing_mail_summary.json b/mail_client/mail_client/report/outgoing_mail_summary/outgoing_mail_summary.json similarity index 95% rename from mail/mail/report/outgoing_mail_summary/outgoing_mail_summary.json rename to mail_client/mail_client/report/outgoing_mail_summary/outgoing_mail_summary.json index 7155a2d5..e14bb47a 100644 --- a/mail/mail/report/outgoing_mail_summary/outgoing_mail_summary.json +++ b/mail_client/mail_client/report/outgoing_mail_summary/outgoing_mail_summary.json @@ -11,7 +11,7 @@ "letterhead": null, "modified": "2024-10-19 16:50:52.361821", "modified_by": "Administrator", - "module": "Mail", + "module": "Mail Client", "name": "Outgoing Mail Summary", "owner": "Administrator", "prepared_report": 0, diff --git a/mail/mail/report/outgoing_mail_summary/outgoing_mail_summary.py b/mail_client/mail_client/report/outgoing_mail_summary/outgoing_mail_summary.py similarity index 98% rename from mail/mail/report/outgoing_mail_summary/outgoing_mail_summary.py rename to mail_client/mail_client/report/outgoing_mail_summary/outgoing_mail_summary.py index ca5ae9e0..d37fc217 100644 --- a/mail/mail/report/outgoing_mail_summary/outgoing_mail_summary.py +++ b/mail_client/mail_client/report/outgoing_mail_summary/outgoing_mail_summary.py @@ -9,7 +9,7 @@ from frappe.query_builder import Criterion, Order from frappe.query_builder.functions import Date, IfNull -from mail.utils.user import get_user_mailboxes, has_role, is_system_manager +from mail_client.utils.user import get_user_mailboxes, has_role, is_system_manager def execute(filters: dict | None = None) -> tuple: diff --git a/mail/mail_server.py b/mail_client/mail_server.py similarity index 85% rename from mail/mail_server.py rename to mail_client/mail_server.py index 881ec683..fe14fcdd 100644 --- a/mail/mail_server.py +++ b/mail_client/mail_server.py @@ -153,53 +153,53 @@ def fetch(self, limit: int = 100, last_synced_at: str | None = None) -> dict[str def get_mail_server_api() -> "MailServerAPI": """Returns a MailServerAPI instance.""" - mail_settings = frappe.get_cached_doc("Mail Settings") + client_settings = frappe.get_cached_doc("Mail Client Settings") return MailServerAPI( - mail_settings.mail_server_host, - mail_settings.mail_server_api_key, - mail_settings.get_password("mail_server_api_secret"), + client_settings.mail_server_host, + client_settings.mail_server_api_key, + client_settings.get_password("mail_server_api_secret"), ) def get_mail_server_auth_api() -> "MailServerAuthAPI": """Returns a MailServerAuthAPI instance.""" - mail_settings = frappe.get_cached_doc("Mail Settings") + client_settings = frappe.get_cached_doc("Mail Client Settings") return MailServerAuthAPI( - mail_settings.mail_server_host, - mail_settings.mail_server_api_key, - mail_settings.get_password("mail_server_api_secret"), + client_settings.mail_server_host, + client_settings.mail_server_api_key, + client_settings.get_password("mail_server_api_secret"), ) def get_mail_server_domain_api() -> "MailServerDomainAPI": """Returns a MailServerDomainAPI instance.""" - mail_settings = frappe.get_cached_doc("Mail Settings") + client_settings = frappe.get_cached_doc("Mail Client Settings") return MailServerDomainAPI( - mail_settings.mail_server_host, - mail_settings.mail_server_api_key, - mail_settings.get_password("mail_server_api_secret"), + client_settings.mail_server_host, + client_settings.mail_server_api_key, + client_settings.get_password("mail_server_api_secret"), ) def get_mail_server_outbound_api() -> "MailServerOutboundAPI": """Returns a MailServerOutboundAPI instance.""" - mail_settings = frappe.get_cached_doc("Mail Settings") + client_settings = frappe.get_cached_doc("Mail Client Settings") return MailServerOutboundAPI( - mail_settings.mail_server_host, - mail_settings.mail_server_api_key, - mail_settings.get_password("mail_server_api_secret"), + client_settings.mail_server_host, + client_settings.mail_server_api_key, + client_settings.get_password("mail_server_api_secret"), ) def get_mail_server_inbound_api() -> "MailServerInboundAPI": """Returns a MailServerInboundAPI instance.""" - mail_settings = frappe.get_cached_doc("Mail Settings") + client_settings = frappe.get_cached_doc("Mail Client Settings") return MailServerInboundAPI( - mail_settings.mail_server_host, - mail_settings.mail_server_api_key, - mail_settings.get_password("mail_server_api_secret"), + client_settings.mail_server_host, + client_settings.mail_server_api_key, + client_settings.get_password("mail_server_api_secret"), ) diff --git a/mail_client/modules.txt b/mail_client/modules.txt new file mode 100644 index 00000000..a480caa9 --- /dev/null +++ b/mail_client/modules.txt @@ -0,0 +1 @@ +Mail Client \ No newline at end of file diff --git a/mail/overrides.py b/mail_client/overrides.py similarity index 95% rename from mail/overrides.py rename to mail_client/overrides.py index ac50c452..6b16541f 100644 --- a/mail/overrides.py +++ b/mail_client/overrides.py @@ -23,7 +23,7 @@ def _throw(msg, raise_exception=True, indicator="red", alert=True): if doc.attached_to_doctype == "Outgoing Mail": file_size = flt(doc.file_size / 1024 / 1024, 3) max_attachment_size = frappe.db.get_single_value( - "Mail Settings", "outgoing_max_attachment_size", cache=True + "Mail Client Settings", "outgoing_max_attachment_size", cache=True ) if file_size > max_attachment_size: diff --git a/mail/patches.txt b/mail_client/patches.txt similarity index 100% rename from mail/patches.txt rename to mail_client/patches.txt diff --git a/mail/public/.gitkeep b/mail_client/public/.gitkeep similarity index 100% rename from mail/public/.gitkeep rename to mail_client/public/.gitkeep diff --git a/mail/tasks.py b/mail_client/tasks.py similarity index 79% rename from mail/tasks.py rename to mail_client/tasks.py index d0dd267c..3f6d9d42 100644 --- a/mail/tasks.py +++ b/mail_client/tasks.py @@ -1,11 +1,11 @@ import frappe -from mail.mail.doctype.incoming_mail.incoming_mail import fetch_emails_from_mail_server -from mail.mail.doctype.outgoing_mail.outgoing_mail import ( +from mail_client.mail_client.doctype.incoming_mail.incoming_mail import fetch_emails_from_mail_server +from mail_client.mail_client.doctype.outgoing_mail.outgoing_mail import ( fetch_and_update_delivery_statuses, transfer_emails_to_mail_server, ) -from mail.utils import enqueue_job +from mail_client.utils import enqueue_job def enqueue_transfer_emails_to_mail_server() -> None: diff --git a/mail/templates/__init__.py b/mail_client/templates/__init__.py similarity index 100% rename from mail/templates/__init__.py rename to mail_client/templates/__init__.py diff --git a/mail/templates/pages/__init__.py b/mail_client/templates/pages/__init__.py similarity index 100% rename from mail/templates/pages/__init__.py rename to mail_client/templates/pages/__init__.py diff --git a/mail/utils/__init__.py b/mail_client/utils/__init__.py similarity index 100% rename from mail/utils/__init__.py rename to mail_client/utils/__init__.py diff --git a/mail/utils/cache.py b/mail_client/utils/cache.py similarity index 100% rename from mail/utils/cache.py rename to mail_client/utils/cache.py diff --git a/mail/utils/email_parser.py b/mail_client/utils/email_parser.py similarity index 99% rename from mail/utils/email_parser.py rename to mail_client/utils/email_parser.py index 0409a484..6d6b91f3 100644 --- a/mail/utils/email_parser.py +++ b/mail_client/utils/email_parser.py @@ -8,7 +8,7 @@ from frappe.utils import cint, get_datetime_str from frappe.utils.file_manager import save_file -from mail.utils import parsedate_to_datetime +from mail_client.utils import parsedate_to_datetime if TYPE_CHECKING: from email.message import Message diff --git a/mail/utils/query.py b/mail_client/utils/query.py similarity index 96% rename from mail/utils/query.py rename to mail_client/utils/query.py index dfd4003f..4d712672 100644 --- a/mail/utils/query.py +++ b/mail_client/utils/query.py @@ -1,7 +1,7 @@ import frappe from frappe.query_builder import Criterion, Order -from mail.utils.user import get_user_mailboxes, has_role, is_system_manager +from mail_client.utils.user import get_user_mailboxes, has_role, is_system_manager @frappe.whitelist() diff --git a/mail/utils/user.py b/mail_client/utils/user.py similarity index 93% rename from mail/utils/user.py rename to mail_client/utils/user.py index 7c929ff7..5db1650b 100644 --- a/mail/utils/user.py +++ b/mail_client/utils/user.py @@ -3,7 +3,7 @@ import frappe from frappe.utils.caching import request_cache -from mail.utils.cache import get_user_incoming_mailboxes, get_user_outgoing_mailboxes +from mail_client.utils.cache import get_user_incoming_mailboxes, get_user_outgoing_mailboxes @request_cache diff --git a/mail/utils/validation.py b/mail_client/utils/validation.py similarity index 100% rename from mail/utils/validation.py rename to mail_client/utils/validation.py diff --git a/mail/www/__init__.py b/mail_client/www/__init__.py similarity index 100% rename from mail/www/__init__.py rename to mail_client/www/__init__.py diff --git a/mail/www/mail.py b/mail_client/www/client.py similarity index 100% rename from mail/www/mail.py rename to mail_client/www/client.py diff --git a/package.json b/package.json index cb9cf6d6..ebe51ce3 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "mail", + "name": "mail_client", "version": "1.0.0", "scripts": { "test-local": "cypress open --e2e --browser chrome", @@ -7,7 +7,7 @@ "dev": "cd frontend && yarn dev", "build": "cd frontend && yarn build" }, - "repository": "https://github.com/frappe/mail", + "repository": "https://github.com/frappe/mail_client", "author": "Frappe", "license": "AGPL-3.0-or-later" } diff --git a/pyproject.toml b/pyproject.toml index f8265355..c8a46656 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [project] -name = "mail" +name = "mail_client" authors = [ { name = "Frappe Technologies Pvt. Ltd.", email = "developers@frappe.io"} ] -description = "Frappe Mail" +description = "Frappe Mail Client" requires-python = ">=3.10" readme = "README.md" dynamic = ["version"]