|
Email Help Needed! Having problems with your email service, or with the email software you're using? Post your questions and answers here! |
|
Thread Tools |
26 May 2021, 05:19 AM | #1 |
Junior Member
Join Date: May 2021
Posts: 4
|
Help to create an "Internal only email"
I am trying to create an "internal only email". Ideally it should only send and receive email from and to my domain and subdomains.
I don't have any idea on how to prevent outgoing email to other email services. For the incoming emails I am trying to create a Sieve Filter to block all external emails. This is what I am trying but for some reason is not working, I receive the emails in my inbox from any address, example, Gmail accounts: Code:
# rule:[Block External Messages] if allof (not address :domain :is "from" "example.com", not header :regex "from" ".*\\.example\\.com$") { fileinto "Trash"; } Last edited by kennio : 26 May 2021 at 05:38 AM. |
26 May 2021, 05:49 AM | #2 | |
Essential Contributor
Join Date: May 2018
Posts: 478
|
Quote:
If you are only accepting incoming mail to your domain (example.com in your example) then the first test on your domain should be sufficient: Code:
if not address :domain :is "from" "example.com" { fileinto "\\Trash"; } Last edited by xyzzy : 26 May 2021 at 06:02 AM. |
|
26 May 2021, 05:58 AM | #3 | ||
Junior Member
Join Date: May 2021
Posts: 4
|
Quote:
Quote:
EDIT: I found this useful tool and my problem was that I forgot to require the regex module. So, the filter for incoming emails is working now. Now I only need to filter the outgoing emails. Any idea of where to start? Last edited by kennio : 26 May 2021 at 06:40 AM. Reason: Update info. |
||
26 May 2021, 11:53 AM | #4 |
Junior Member
Join Date: May 2021
Posts: 4
|
So, the part of blocking incoming emails is done, now I need to block outgoing emails. I was investigating a looks like this is possible with Postfix. But I am new to email servers and I don't know how to configure it.
I also posted the question at Server Fault to see if we can find a solution together. |
26 May 2021, 02:34 PM | #5 |
The "e" in e-mail
Join Date: Feb 2006
Location: EU
Posts: 4,945
|
Sending email from elsewhere than example.com to Trash is not the same as rejecting email from non-example.com. The difference may or may not matter for your purposes,
|
26 May 2021, 03:42 PM | #6 | ||
Essential Contributor
Join Date: May 2018
Posts: 478
|
Quote:
Bottom line, postifx (sendmail is another if I recall) has absolutely nothing to do with Fastmail so it isn't going to help you if you want to continue to use only Fastmail. Fastmail always sends out what you send be it a valid destination or not. Quote:
|
||
26 May 2021, 04:37 PM | #7 |
Essential Contributor
Join Date: Dec 2017
Location: Scotland
Posts: 492
|
> I don't have any idea on how to prevent outgoing email to other email services.
I've no idea how to do it with Postfix etc, but I /have/ in the past been able to do this with one specific mail client (unfortunately no longer maintained so I cannot recommend it). It supported filtering of outbound Mail (also: outbound News, incoming Mail, incoming News, items seen when a folder was opened, and items about to be considered for automatic expiry). I used outbound filters to make sure that only email addresses of mine which I used for emails (or news posts) to certain places were used when mails / posts were sent to those places. For example, that a mail to a mail-list server could not be sent using an address which I intended only to be used for my bank, and vice versa. Although usually mails/posts got composed with appropriate sender ids, sometimes I'd accidentally pick the wrong one off a drop-down list of alternatives, or an automatically chosen sender id would be wrong. The latter could happen if eg all replies to items stored in a particular folder would automatically get written using that folder's default sending id, but a mail had incorrectly been placed in the wrong folder. The outbound filters in essence prevented the mails / news posts concerned from being placed in the outbound mail/news queues and would instead put them in a "Blocked send" folder (and play a sound to alert me that that had happened). |
26 May 2021, 10:51 PM | #8 |
Junior Member
Join Date: May 2021
Posts: 4
|
This seams not to be as easy as I was expecting. I think that maybe I would need to create take some list of email providers and black list them.
Looks like I can do a blacklist with postfix but I don't know yet how to use it only when the email comes from @internal.example.com and not from @example.com |