From 04713eff3dcc418d18cf14add7a1368f96d5adcd Mon Sep 17 00:00:00 2001 From: Son NK Date: Sun, 26 Apr 2020 10:02:10 +0200 Subject: [PATCH 1/6] show alias creation date in "more" section if not shown yet --- app/dashboard/templates/dashboard/index.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/dashboard/templates/dashboard/index.html b/app/dashboard/templates/dashboard/index.html index 0f9344c0..ddd78abd 100644 --- a/app/dashboard/templates/dashboard/index.html +++ b/app/dashboard/templates/dashboard/index.html @@ -212,10 +212,16 @@ -
+
+ + {% if alias_info.latest_email_log != None %} +
+ Alias created {{ alias.created_at | dt }} +
+ {% endif %} {% if mailboxes|length > 1 %} -
Current mailbox
+
Current mailbox
+ placeholder="e.g. where the alias is used or why is it created">{{ alias.note or "" }}
@@ -267,6 +268,29 @@
+
+ Alias name + +
+ +
+
+ +
+ + +
+ + save + +
+ + +
+
@@ -501,5 +525,31 @@ } }) + + $(".save-alias-name").on("click", async function () { + let aliasId = $(this).data("alias"); + let name = $(`#alias-name-${aliasId}`).val(); + + try { + let res = await fetch(`/api/aliases/${aliasId}`, { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + name: name, + }), + }); + + if (res.ok) { + toastr.success(`Alias Name Saved`); + } else { + toastr.error("Sorry for the inconvenience! Could you refresh the page & retry please?", "Unknown Error"); + } + } catch (e) { + toastr.error("Sorry for the inconvenience! Could you refresh the page & retry please?", "Unknown Error"); + } + + }) {% endblock %} From 3063fee47263d54fe130421095287c3d3665d16a Mon Sep 17 00:00:00 2001 From: Son NK Date: Sun, 26 Apr 2020 10:41:24 +0200 Subject: [PATCH 6/6] Use alias name in reply phase --- email_handler.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/email_handler.py b/email_handler.py index a9201521..dd6f90c2 100644 --- a/email_handler.py +++ b/email_handler.py @@ -513,7 +513,12 @@ def handle_reply(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, str delete_header(msg, "Received") # make the email comes from alias - add_or_replace_header(msg, "From", alias.email) + if alias.name: + LOG.d("Put alias name in from header") + from_header = formataddr((alias.name, alias.email)) + else: + from_header = alias.email + add_or_replace_header(msg, "From", from_header) # some email providers like ProtonMail adds automatically the Reply-To field # make sure to delete it