# Email Plugin Implementation & UI

**URL:** <https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875>\
**Category:** Email Plugin\
**Tags:** gsoc-2022\
**Created:** [31 May 2022 11:51 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875 "2022-05-31T11:51:05Z")\
**Posts on this page:** 17\
**Page:** 2

<div class="post-metadata">

**Author:** ![PackElend](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/packelend/32/488_2.png) [@PackElend](https://discourse.joplinapp.org/u/PackElend)\
**Post date:** [2 June 2022 09:06 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/21 "2022-06-02T09:06:08Z")

</div>

> [@roman\_r\_m](#):
>
> there's no central Joplin server

[there is](https://joplinapp.org/changelog_server/) but we don't want to integrate an email server into it.  
I could imagine that someone will modify the docker-compose file to add an email server

---

<div class="post-metadata">

**Author:** ![roman\_r\_m](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/roman_r_m/32/3297_2.png) [@roman\_r\_m](https://discourse.joplinapp.org/u/roman_r_m)\
**Post date:** [2 June 2022 09:21 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/22 "2022-06-02T09:21:37Z")

</div>

> [@PackElend](#):
>
> [there is](https://joplinapp.org/changelog_server/) but we don't want to integrate an email server into it.

I meant central in the sense that every user must connect to it, as it is the case with Evernote (as far as I know)

---

<div class="post-metadata">

**Author:** ![bishoy](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bishoy/32/13856_2.png) [@bishoy](https://discourse.joplinapp.org/u/bishoy)\
**Post date:** [2 June 2022 11:27 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/23 "2022-06-02T11:27:34Z")

</div>

yes, I think that editing the subject (forward) will be enough because I already have a copy of the subject of the original emails like this:  
 ![screenshot](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/2X/9/9cdc284d217c8c2876531a08ff5eaa91f89e0d09.png)

---

<div class="post-metadata">

**Author:** ![bishoy](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bishoy/32/13856_2.png) [@bishoy](https://discourse.joplinapp.org/u/bishoy)\
**Post date:** [2 June 2022 11:29 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/24 "2022-06-02T11:29:07Z")

</div>

well, I will edit the timeline and intend to do manual fetching in the future.

I'm grateful for your help and suggestions, Thank you. 🥰

---

<div class="post-metadata">

**Author:** ![bishoy](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bishoy/32/13856_2.png) [@bishoy](https://discourse.joplinapp.org/u/bishoy)\
**Post date:** [2 June 2022 11:32 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/25 "2022-06-02T11:32:51Z")

</div>

> [@bepolymathe](#):
>
> to use this by archiving emails in Joplin and other users would rather like to collect emails as tasks.

But I worry about archiving emails because they go to the **All Email** not the specific mailbox and I think it is difficult to convert the huge number of emails that will be in All Email 😅.

Anyway, after the user connects to IMAP, the plugin will allow the user to choose what mailbox, folder, or tag they want to be monitored and converted into notes.

---

<div class="post-metadata">

**Author:** ![bepolymathe](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bepolymathe/32/8492_2.png) [@bepolymathe](https://discourse.joplinapp.org/u/bepolymathe)\
**Post date:** [2 June 2022 11:48 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/26 "2022-06-02T11:48:22Z")

</div>

> [@bishoy](#):
>
> But I worry about archiving emails because they go to the **All Email** not the specific mailbox and I think it is difficult to convert the huge number of emails that will be in All Email 😅.

I thought especially in the case of use mentioned above where the user would use an email box dedicated to Joplin (therefore empty at the start) and would only transfer the messages he wants to find in Joplin in the form of notes (" archives ") or tasks (" todo ")

---

<div class="post-metadata">

**Author:** ![bepolymathe](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bepolymathe/32/8492_2.png) [@bepolymathe](https://discourse.joplinapp.org/u/bepolymathe)\
**Post date:** [2 June 2022 11:50 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/27 "2022-06-02T11:50:30Z")

</div>

And if no argument is specified the title the note would be empty ?

---

<div class="post-metadata">

**Author:** ![bishoy](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bishoy/32/13856_2.png) [@bishoy](https://discourse.joplinapp.org/u/bishoy)\
**Post date:** [2 June 2022 12:20 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/28 "2022-06-02T12:20:56Z")

</div>

exactly, and my personal opinion is that this idea is both organized and very simple for the user, especially if an email contains a lot of messages and is not organized.

---

<div class="post-metadata">

**Author:** ![bishoy](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bishoy/32/13856_2.png) [@bishoy](https://discourse.joplinapp.org/u/bishoy)\
**Post date:** [2 June 2022 12:24 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/29 "2022-06-02T12:24:45Z")

</div>

Not exactly, by default the subject of the forwarded message is the same as the subject of the original prefixed with the word Fwd like:  
Fwd: the subject of the original email `@Note #tag`

And if the user is forced not to have anything in its subject in a forwarded email, Joplin, by default, takes the first line of note and takes it as the title.

---

<div class="post-metadata">

**Author:** ![bepolymathe](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bepolymathe/32/8492_2.png) [@bepolymathe](https://discourse.joplinapp.org/u/bepolymathe)\
**Post date:** [2 June 2022 12:38 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/30 "2022-06-02T12:38:47Z")

</div>

Okay. Besides, it makes me think that it is not always very useful to have the mention of the transfer in each email ("Fw", "Fwd", "Tr", etc)

It would surely be interesting to allow a "trim" option ? Regular expression could help in this case.

![image](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/2X/e/e7817c43485f7d8577069f596c017db54f9a8040.png)

Trim subject with regular expression like :

`^(((Re|Fw|Fwd|TR|Tr):|(\[.*\])) ?)*`

The thunderbird addon works like this.

---

<div class="post-metadata">

**Author:** ![bishoy](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bishoy/32/13856_2.png) [@bishoy](https://discourse.joplinapp.org/u/bishoy)\
**Post date:** [2 June 2022 13:10 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/31 "2022-06-02T13:10:54Z")

</div>

But I think it will be difficult for the user to use regular expressions. I think using things like @NoteName or #tag will be enough and Simply after sending the email, it will be the newest email received.

@bepolymathe Thank you for these pretty notes and suggestions. 🥰

---

<div class="post-metadata">

**Author:** ![roman\_r\_m](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/roman_r_m/32/3297_2.png) [@roman\_r\_m](https://discourse.joplinapp.org/u/roman_r_m)\
**Post date:** [2 June 2022 13:45 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/32 "2022-06-02T13:45:23Z")

</div>

> [@bishoy](#):
>
> But I think it will be difficult for the user to use regular expressions.

Then they just won't use them, not a problem. Just put some meaningful defaults there as @bepolymathe suggested and it will (almost) never need to be changed.

Maybe one exception is if the user's email client is in another language, and uses some equivalent of re/fwd/etc in that other language. Then they might want to change/extend that regex.

Or, instead of regular expressions it may be enough to specify prefixes. It's not like you can have "re" or "fwd" added in the middle of the subject (at least I hope not!). Although I'm not sure if this would work with RTL languages like Arabic. That you should know better than I do.

---

<div class="post-metadata">

**Author:** ![bishoy](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bishoy/32/13856_2.png) [@bishoy](https://discourse.joplinapp.org/u/bishoy)\
**Post date:** [3 June 2022 10:30 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/33 "2022-06-03T10:30:58Z")

</div>

> [@roman\_r\_m](#):
>
> Maybe one exception is if the user's email client is in another language, and uses some equivalent of re/fwd/etc in that other language. Then they might want to change/extend that regex.

I tested it on a number of languages, including Arabic, and 'Fwd:' is standard for all languages in Gmail, AOL. and 'Fw:' for Outlook, Yahoo

IMAP log in Arabic subject example:

```auto
(#1860) Parsed header: {
  date: ['Fri, 3 Jun 2022 12:01:00 +0200'],
  subject: ['Fwd: اللغة العربية @ملاحظة #علامة'],
  from: ['Bishoy Magdy <bishoy.magdy.adeeb@gmail.com>'],
  to: ['Bishoy Magdy <bishoy.magdy.adeeb@gmail.com>']
}

```

This means that, whatever the language, the prefix of the subject is Fwd: or Fw:

> [@roman\_r\_m](#):
>
> Or, instead of regular expressions it may be enough to specify prefixes. It's not like you can have "re" or "fwd" added in the middle of the subject (at least I hope not!).

I thought about that too, It is not only an Fwd or Fw check, and it must also be preceded by a colon ":" , Fwd:

I have another solution. You can search in the email after parsing for the first line that has the "Subject:"

* * *

When I use OAuth, the Google API gives me a client secret, which is a secret used by the OAuth Client to authenticate to the Authorization Server. The Client Secret is a secret known only to the OAuth Client and the Authorization Server, and I use the client's secret when posting a request to get an access token.  
So is there any way to hide the client's secret in the Joplin plugin?

---

<div class="post-metadata">

**Author:** ![bepolymathe](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bepolymathe/32/8492_2.png) [@bepolymathe](https://discourse.joplinapp.org/u/bepolymathe)\
**Post date:** [3 June 2022 10:39 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/34 "2022-06-03T10:39:04Z")

</div>

> [@bishoy](#):
>
> This means that, whatever the language, the prefix of the subject is Fwd: or Fw:

🤔 For me it’s always "Tr" "tr" with my professionnal account (like "transfert")

---

<div class="post-metadata">

**Author:** ![bishoy](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bishoy/32/13856_2.png) [@bishoy](https://discourse.joplinapp.org/u/bishoy)\
**Post date:** [3 June 2022 10:53 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/35 "2022-06-03T10:53:25Z")

</div>

hmmmmmmmmmm 🤔🤔  
I think this happened because your Gmail or email provider is itself is french or whatever language not only the content of the email.

I don't think there is a general solution to this problem and Evernote itself leaves email itself without any modification.

What do you think of this other solution?

> [@bishoy](#):
>
> I have another solution. You can search in the email after parsing for the first line that has the "Subject:"

---

<div class="post-metadata">

**Author:** ![roman\_r\_m](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/roman_r_m/32/3297_2.png) [@roman\_r\_m](https://discourse.joplinapp.org/u/roman_r_m)\
**Post date:** [3 June 2022 14:24 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/36 "2022-06-03T14:24:51Z")

</div>

> [@bishoy](#):
>
> I don't think there is a general solution to this problem and Evernote itself leaves email itself without any modification.

Why don't you do the same, at least initially, and not spend too much time on this relatively minor thing.

> [@bishoy](#):
>
> So is there any way to hide the client's secret in the Joplin plugin?

Check how it stores other secrets, like WebDAV password or Dropbox token.

---

<div class="post-metadata">

**Author:** ![bishoy](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/bishoy/32/13856_2.png) [@bishoy](https://discourse.joplinapp.org/u/bishoy)\
**Post date:** [11 June 2022 03:05 UTC](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875/37 "2022-06-11T03:05:11Z")

</div>

The post has been updated 😀

[Previous page](https://discourse.joplinapp.org/t/email-plugin-implementation-ui/25875.md?page=1)
