Skip to content

Commit

Permalink
refactor!: rename app to mail_client
Browse files Browse the repository at this point in the history
  • Loading branch information
s-aga-r committed Nov 8, 2024
1 parent 47e03dd commit bfaebad
Show file tree
Hide file tree
Showing 118 changed files with 236 additions and 233 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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'
Expand All @@ -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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/.*
)$
Expand All @@ -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:
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h2>Frappe Mail</h2>
</div>

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.
Expand All @@ -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:
Expand All @@ -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:

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
```

Expand All @@ -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)
Binary file modified docs/screenshots/mail-settings-details.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/mail-settings-incoming.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Frappe UI App</title>
<title>Frappe Mail Client</title>
</head>
<body>
<div id="app"></div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Controls/MultiselectInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/MailDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Modals/SendMail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Inbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Sent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const routes = [
]

let router = createRouter({
history: createWebHistory('/mail'),
history: createWebHistory('/client'),
routes,
})

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/stores/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/stores/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/],
Expand Down
4 changes: 2 additions & 2 deletions frontend/yarn-error.log
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion mail/modules.txt

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions mail/api/auth.py → mail_client/api/auth.py
Original file line number Diff line number Diff line change
@@ -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,
)
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions mail/api/inbound.py → mail_client/api/inbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion mail/api/outbound.py → mail_client/api/outbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
2 changes: 1 addition & 1 deletion mail/api/track.py → mail_client/api/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
6 changes: 4 additions & 2 deletions mail/api/webhook.py → mail_client/api/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit bfaebad

Please sign in to comment.