Skip to content

Conversation

@jll-02
Copy link
Contributor

@jll-02 jll-02 commented Mar 31, 2025

Description

I want to be able to send email with different priorities / importance shown in the email, e.g. in outlook shown as an exclamation mark or an arrow.
This should be an optional argument since I want to send normal emails most of the time and the existing code still has to work.

This PR introduces this change:
I can set the "X-Priority" when calling the frappe.sendmail function. This argument will be passed to the email header where it will be set to the correct Header Setting to take effect.

Additional notes

I firstly created this with an Enum however I wasn't sure where to create the Enum. I would have had to import this very specific Enum in the frappe/__init__.py to set the default value. I did not feel comfortable with it. I would be willing to use an enum again if someone could tell me where best to create it and if it would be alright to import it in the frappe/__init__.py.

If there are other questions about my code, feel free to ask

Backport

when merging this a backport to v-15 would be much appreciated.

@jll-02 jll-02 force-pushed the patch-8 branch 2 times, most recently from c47c980 to 68d96a7 Compare March 31, 2025 12:05
@akhilnarang akhilnarang requested a review from s-aga-r April 11, 2025 06:04
@s-aga-r
Copy link
Contributor

s-aga-r commented Apr 11, 2025

@jll-02 Since X-Priority is not universally supported by modern SMTP servers (like Stalwart) and clients, we should avoid setting a default priority of 3. Instead, the X-Priority header should only be included when x_priority is explicitly specified.

…il function

creating the option to give the email an importance.
1 = Highest, 3 = Normal, 5 = Lowest
commonly used to flag the importance of emails
@jll-02
Copy link
Contributor Author

jll-02 commented Apr 11, 2025

@s-aga-r Good Point.
I have changed the code so the X-Priority will appended to the header if the Priority is not normal.
This will still work since there is no marking for normal mails.

If you have anything else, please let me know

@s-aga-r s-aga-r merged commit 89ed7c9 into frappe:develop Apr 11, 2025
24 checks passed
@akhilnarang akhilnarang added the backport version-15-hotfix Backport the PR to v15 label Apr 11, 2025
mergify bot pushed a commit that referenced this pull request Apr 11, 2025
…il function (#31966)

creating the option to give the email an importance.
1 = Highest, 3 = Normal, 5 = Lowest
commonly used to flag the importance of emails

Co-authored-by: Jan Lukas Liesen <=>
(cherry picked from commit 89ed7c9)
akhilnarang pushed a commit that referenced this pull request Apr 15, 2025
…il function (#31966) (#32089)

creating the option to give the email an importance.
1 = Highest, 3 = Normal, 5 = Lowest
commonly used to flag the importance of emails

Co-authored-by: Jan Lukas Liesen <=>
(cherry picked from commit 89ed7c9)

Co-authored-by: jll-02 <63648645+jll-02@users.noreply.github.com>
frappe-pr-bot pushed a commit that referenced this pull request Apr 15, 2025
# [15.64.0](v15.63.1...v15.64.0) (2025-04-15)

### Bug Fixes

* check if user is diabled during api authentication ([ba81f14](ba81f14))
* compare lowercase keyword in global search ([#31832](#31832)) ([df0d514](df0d514))
* drop `branch_name` ([7e2c2a3](7e2c2a3))
* Event google URL field not big enough for irl data ([08e7aba](08e7aba))
* **event:** Handle month ends for repeating monthly ([d1e5c09](d1e5c09))
* **google-calendar:** Use byday variable type properly ([3829c2a](3829c2a))
* improve url validation ([#32052](#32052)) ([#32078](#32078)) ([4907ade](4907ade))
* increase failure threshold for preapred report ([#32063](#32063)) ([#32070](#32070)) ([495db3d](495db3d))
* linter config in boilerplate ([fea2139](fea2139))
* list_view_settings can be missing ([#32048](#32048)) ([8c7e860](8c7e860))
* make app installation possible again ([4d774e8](4d774e8))
* only exclude RUF001 where we're using some ambiguous characters ([42379ea](42379ea))
* Prevent duplicate ToDo creation when assigning ([dc3370b](dc3370b))
* print builder beta print option not working ([5977581](5977581))
* **push_notification:** use cstr to convert a None body to empty string ([#32056](#32056)) ([#32062](#32062)) ([9b7b44d](9b7b44d))
* remove print statement ([ebc484f](ebc484f))
* respect include filters while generating report name ([25d87bd](25d87bd))
* Show doctype name in perm check errors ([#32122](#32122)) ([#32125](#32125)) ([75cc5d1](75cc5d1))
* skip adding app to list if we can't run the permission hook ([#32134](#32134)) ([1d03333](1d03333))
* switch to ruff ([d84dda8](d84dda8))
* sync translations from crowdin ([#32012](#32012)) ([257a864](257a864))
* Use GET for get_events for notification bar ([5215f91](5215f91))
* **UX:** block inserting more than 5000 items in table ([#32127](#32127)) ([#32130](#32130)) ([8e74e4e](8e74e4e))

### Features

* ✨ addes x-priority option to email header and the frappe.sendmail function ([#31966](#31966)) ([#32089](#32089)) ([5cc38b6](5cc38b6))
* add info about pre-commit to README ([7d1b92a](7d1b92a))
* ask for branch name ([a70f2e5](a70f2e5))
* copy config files to new app ([745400f](745400f))
* create pre-commit config for new app ([d1254d3](d1254d3))
* linter workflow for new apps ([186e46d](186e46d))
* protect attached files (backport [#31855](#31855)) ([#31970](#31970)) ([15334b6](15334b6))

### Reverts

* Revert "refactor: _create_app_boilerplate" ([a924cce](a924cce))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport version-15-hotfix Backport the PR to v15

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants