EmailDiscussions.com  

Go Back   EmailDiscussions.com > Discussions about Email Services > Email Help Needed!
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Stay in touch wirelessly

Email Help Needed! Having problems with your email service, or with the email software you're using? Post your questions and answers here!

Reply
 
Thread Tools
Old 26 May 2021, 05:19 AM   #1
kennio
Junior Member
 
Join Date: May 2021
Posts: 4
Arrow 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.
kennio is offline   Reply With Quote

Old 26 May 2021, 05:49 AM   #2
xyzzy
Essential Contributor
 
Join Date: May 2018
Posts: 474
Quote:
Originally Posted by kennio View Post
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...
To send stuff to the trash you specify the mailbox name as "\\Trash". Just saying "trash" will send stuff, by default, into the inbox.

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.
xyzzy is offline   Reply With Quote
Old 26 May 2021, 05:58 AM   #3
kennio
Junior Member
 
Join Date: May 2021
Posts: 4
Quote:
Originally Posted by xyzzy View Post
Not sure what that means? Email you send doesn't go through your sieve script.
Ok, thank you. I understand that emails sent by me doesn't go through your sieve script, but, is there any other method to stop this kind of email from being sent?

Quote:
Originally Posted by xyzzy View Post
Second, 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:
I should accept email from my domain and subdomains, like john.doe@example.com and jane.doe@sales.example.com (and I am trying to avoid listing all the subdomains as I don't want to need to remember the filter if I create any other domain in the future).

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.
kennio is offline   Reply With Quote
Old 26 May 2021, 11:53 AM   #4
kennio
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.
kennio is offline   Reply With Quote
Old 26 May 2021, 02:34 PM   #5
janusz
The "e" in e-mail
 
Join Date: Feb 2006
Location: EU
Posts: 4,943
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,
janusz is offline   Reply With Quote
Old 26 May 2021, 03:42 PM   #6
xyzzy
Essential Contributor
 
Join Date: May 2018
Posts: 474
Quote:
Originally Posted by kennio View Post
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.
Postfix is a mail MTA (mail transfer agent) to allow sending and receiving email through it. And you need to interface it through some appropriate UI (like your command line terminal). You probably could configure it to "reject" all but a specific domain (there's lots of config setting but I don't know if there's one for that). But if you go that far to send mail through postfix you might as will just forget about Fastmail and use it for receiving as well (again appropriately configured).

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:
I found this useful tool and my problem was that I forgot to require the regex module.
Yes, it's your responsibility to add all the appropriate extension requires when using Sieve Tester.
xyzzy is offline   Reply With Quote
Old 26 May 2021, 04:37 PM   #7
JeremyNicoll
Essential Contributor
 
Join Date: Dec 2017
Location: Scotland
Posts: 484
> 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).
JeremyNicoll is offline   Reply With Quote
Old 26 May 2021, 10:51 PM   #8
kennio
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
kennio is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +9. The time now is 09:52 AM.

 

Copyright EmailDiscussions.com 1998-2022. All Rights Reserved. Privacy Policy