ScottPeterJohnson / purelymail-issues

Issues repository for the Purelymail email service.
38 stars 0 forks source link

Documentation Request: Best Client/Practices for Aggregating Email Accounts into a Single Inbox? #87

Open ScottPeterJohnson opened 2 years ago

ScottPeterJohnson commented 2 years ago

(This issue was imported from Gitea) byb on January 28, 2022: Hello,

Purelymail is awesome, but perhaps I've gotten a little carried away with creating email addresses. I could use some advice from experts about how to manage multiple email accounts into a single inbox. I could really use a guide on how to accomplish this with purelymail from the perspective of a somewhat new user who managed to set up their own domain.

After creating about 10 email accounts, it became cumbersome to log-in and log-out of the purelymail webgui to check for new mail. Now that I'm well past that number, it's completely unworkable. I need a single inbox to collect all emails from different accounts and the ability to reply to them using the intended account.

Desktop/Mobile Clients

Ultimately, I want the freedom to access my email from multiple PCs and not be tied to a single PC desktop instance. With that said, here's my experience

Server-based Tools

Since I'm not an expert of server administration, I use a lot of Docker images. Here's what I've found:

Alternatives

I'm sure there are people out there who have solved this issue and can offer valuable insights on the direction I should go. Thank you!

ScottPeterJohnson commented 2 years ago

Comment by Scott on January 29, 2022: I think your use-case is pretty clearly a matter of routing. The important thing to realize is that a user is not an email address; a user can effectively have many email addresses. Every user is associated with an email address that they use to log in, but they don't necessarily need to even receive mail at that address.

For example, suppose I'm interested in the email addresses "example@mydomain.com" and "other@mydomain.com". If I create a user "example@mydomain.com" and I use a routing rule to redirect mail from "other@mydomain.com" to "example@mydomain.com", then I can log in to one user account and receive emails for both addresses, and I can also "send as" both addresses (since the overall account owns both). You may need to create something called an "Identity" in a third party mail app to do this automatically.

If the addresses are on a shared domain (e.g. @purelymail.com), then you do have to create the user "other@purelymail.com" to reserve the address for your account. But you don't have to use it; you can set up a webmail filter in "other@purelymail.com" that redirects to "example@purelymail.com".

I'm open to creating documentation on this (maybe some FAQ questions to catch people who are thinking about users/email addresses too restrictively) if I understood your problem correctly.

ScottPeterJohnson commented 2 years ago

Comment by byb on February 2, 2022: Yes, using routing will be helpful by adding an additional layer, however, it is useful to have different sets of inboxes to prevent files from being co-mingled. I don't want everything to go to one inbox, which re-introduces the log-in/log-out problem.

ScottPeterJohnson commented 2 years ago

Comment by Scott on February 2, 2022: In that case, after routing you just have a webmail filter (Sieve) script that redirects the mail to different folders. Clients should be better able to handle multiple folders than multiple accounts.

ScottPeterJohnson commented 2 years ago

Comment by byb on February 11, 2022: Hi, thank you so much for your help. I finally had some time to look at this today. Also, I apologize for the typos in my original message.

Today, I had a situation where I wanted to send a message using a "burner" email address and thought I would try to use sieve.

Attempted Steps

I wrote this as I went along, until I was successful. In the end, these steps are sort of backwards, and a couple of them can be eliminated.

  1. I went to http://sieve.info/ but found a couple broken links and found some somewhat high-level information. I followed the link to this wiki page https://en.wikipedia.org/wiki/Sieve_%28mail_filtering_language%29#Example which seems to have the example script I'm looking for to modify.
    
    # Sieve filter

Declare the extensions used by this script.

# require ["fileinto", "reject"];

Messages bigger than 100K will be rejected with an error message

# if size :over 100K { reject "I'm sorry, I do not accept mail over 100kb in size. Please upload larger files to a server and send me a link. Thanks."; }

Mails from a mailing list will be put into the folder "mailinglist"

# elsif address :is ["From", "To"] "mailinglist@blafasel.invalid" { fileinto "INBOX.mailinglist"; }

Spam Rule: Message does not contain my address in To, CC or BCC

header, or subject is something with "money" or "Viagra".

# elsif anyof (not address :all :contains ["To", "Cc", "Bcc"] "me@blafasel.invalid", header :matches "Subject" ["money","Viagra"]) { fileinto "INBOX.spam"; }

Keep the rest.

This is not necessary because there is an "implicit keep" rule

# else { keep; }


2. I logged into my purelymail admin account and navigated to [https://purelymail.com/manage/accountSieve](hhttps://purelymail.com/manage/accountSieve), I modified the script and pasted it into the box, but then reviewed the bullet points above and saw this:
> This is an account-wide script. The "redirect", "keep", and "reject" actions all work, but "fileinto" will not work at this stage. **Use "fileinto" in a user Sieve script (called a "filter" in the webmail) instead.**

This left me scratching my head for a minute, so I left this page open in one tab and continued investigating. **After Success Note:** It later turned out that this step is not needed.

3. I logged into one of the accounts I created and found this page: [https://inbox.purelymail.com/?_task=settings&_action=plugin.managesieve#](https://inbox.purelymail.com/?_task=settings&_action=plugin.managesieve#)

At first, this page was a little baffling because it had a bunch of input boxes, but then I found what I needed...

4. I clicked the "roundcube" dropdown button, and then selected the "roundcube" entry below.
5. I then clicked "Actions" and chose "Edit filter set".
6. The right pane opened with a text entry box which looked like the place to paste my script:

/ empty script /

7. I pasted my modified script (changed the domain to my own) into the box and clicked save.
8. Test Attempt no. 1 - I tried sending an email to the address I specified, but purelymail bounced it back saying it didn't exist.
9. I created the account and tried sending an email.
10. Test Attempt no. 2 - The email seems to have been sent successfully (no bounceback), but didn't appear in my account, probably because I didn't create the folder INBOX.mailinglist, so...
11. I created the folder using the webmail.
12. Test Attempt no. 3 - I tried sending a third test email, but it didn't appear in the inbox (or the subfolder)... so now I need ot set up routing?
13. I navigated to [https://purelymail.com/manage/routing](https://purelymail.com/manage/routing) and created the entry and clicked save.
14. Test Attempt no. 4 - **SUCCESS!** [https://inbox.purelymail.com/?_task=mail&_mbox=INBOX.mailinglist](https://inbox.purelymail.com/?_task=mail&_mbox=INBOX.mailinglist)

**Bonus.** I opened my MailPile instance and found that MailPile created the folder and placed it inside.

This works, but I wanted to eliminate steps 8 and 9 (creating accounts and passwords isn't really necessary), so instead I created the "routing" address by changing the setting from "The exact address" to "Any address starting with" , created the folder, created the identity, and created a new sieve filter. 

#### Minor Roundcube/Webmail Issue
I know you are not roundcube support, but is it possible to automatically set the "reply" from email to the "to" email address? I mean if an email was sent to "mailinglist@domain.com" and that identity exists, is there an option in the settings? This is a minor issue... I see MailPile defaults to this.
**EDIT** Okay, it seems settings the display name, email, and reply-to fields solved this problem.

### Greedy Ask
I wonder if a macro could be created to combine all 4 of those steps:
* Define the address to route
* Insert these items into the roundcube mailbox:
  * Create the identity
  * Create the folder
  * Add the sieve filter

#### Undoing My Mess
Okay, so now how can I consolidate all the email I had sent off to various accounts back into a single email box?
**EDIT** I will try the import/export tool. [https://purelymail.com/manage/portMail](https://purelymail.com/manage/portMail)

#### **EDIT** Mass Testing elsif or if
I wanted to make sure that all my rules were working correctly... so I tried to send an email from one of my accounts to 30+ emails on BCC. However, the email only appeared in one box. I'm wondering if my sieve script should use "if", instead of "elsif".

I wrote a small python script to help generate the sieve filter:

email_list = ["an_email_address@a_domain.com", "another_email_address@a_domain.com"] for email in email_list: emailinbox = email.replace("@a_domain.com", "") basic_elsif = f"elsif address :is [\"From\", \"To\"] \"{email}\" {{\n fileinto \"INBOX/{emailinbox}\";\n}}" print(basic_elsif)


The output looks like this (note: I don't know if underscore characters are valid in folders, I don't think . or @ are.)

elsif address :is ["From", "To"] "an_email_address@a_domain.com" { fileinto "INBOX/an_email_address"; } elsif address :is ["From", "To"] "another_email_address@a_domain.com" { fileinto "INBOX/another_email_address"; }



Anyway awesome! Thanks for the hints.
ScottPeterJohnson commented 2 years ago

Comment by Scott on February 12, 2022:

I wonder if a macro could be created to combine all 4 of those steps:

Define the address to route Insert these items into the roundcube mailbox: Create the identity Create the folder Add the sieve filter

This use case might be covered if/when I have a formal alias feature.

I wanted to make sure that all my rules were working correctly... so I tried to send an email from one of my accounts to 30+ emails on BCC. However, the email only appeared in one box. I'm wondering if my sieve script should use "if", instead of "elsif".

When multiple recipients on a single email all resolve to a single address, it collapses into one "instance" of email for that user. But even if it didn't, you'd still just get 30+ emails into one box: you're using the address test, which is based off the From/To header, which doesn't include BCC and is always the same for the same email. You may want the envelope test instead.

ScottPeterJohnson commented 2 years ago

Comment by byb on February 12, 2022:

I wonder if a macro could be created to combine all 4 of those steps:

Define the address to route Insert these items into the roundcube mailbox: Create the identity Create the folder Add the sieve filter

This use case might be covered if/when I have a formal alias feature.

Great!

I wanted to make sure that all my rules were working correctly... so I tried to send an email from one of my accounts to 30+ emails on BCC. However, the email only appeared in one box. I'm wondering if my sieve script should use "if", instead of "elsif".

When multiple recipients on a single email all resolve to a single address, it collapses into one "instance" of email for that user. But even if it didn't, you'd still just get 30+ emails into one box: you're using the address test, which is based off the From/To header, which doesn't include BCC and is always the same for the same email. You may want the envelope test instead.

I'll have to look into that a bit more. Eventually all the emails did come through... maybe because on the first try I had incorrectly used the routing feature (I put all the addresses separated by commas, which was intended for multiple emails). Maybe the emails were 'on-hold' by the server and once the rule was fixed they were delivered?

Perhaps my documentation request can be turned into an article/document which can be used to market purelymail. Having a step-by-step guide showing off how this feature works might attract a lot of potential customers.

I'll leave this ticket for you to close (both for the document and the formal alias feature).

ScottPeterJohnson commented 2 years ago

Comment by byb on February 14, 2022:

When multiple recipients on a single email all resolve to a single address, it collapses into one "instance" of email for that user. But even if it didn't, you'd still just get 30+ emails into one box: you're using the address test, which is based off the From/To header, which doesn't include BCC and is always the same for the same email. You may want the envelope test instead.

Returning to say, yes, envelope is probably what I need. I found that emails which the target address is on "cc" do not get sent to the correct email box. I need to rewrite my rules. I also need to see if there is a sieve rule which matches the "startswith" feature. I found that some emails with periods in them were getting returned as undeliverable.

Now the "formal alias feature" seems very ambitious. Perhaps there are a few use cases which would suit most users.