EmailDiscussions.com  

Go Back   EmailDiscussions.com > Email Service Provider-specific Forums > FastMail Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Stay in touch wirelessly

FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc.

Reply
 
Thread Tools
Old 27 Mar 2018, 06:56 PM   #1
ferrety
Member
 
Join Date: Mar 2018
Posts: 40
Blocking emails from specific domain

Is it possible with fastmail (standard account) to set up a rule or something to reject emails from a specific domain.
I don't want them to go into spam I want them to bounce back to the sender as rejected. I want them to know the email hasn't reached me.

So I could for example allow normal amazon emails through but stop marketplace sellers contacting me, begging for reviews etc (sometimes years after a purchase).

So could I say, bounce stuff coming from @marketplace.amazon.co.uk but allow normal Amazon system emails through (these have a different domain)

Please no lectures about complaining to Amazon, thanks it is just an example

Last edited by ferrety : 27 Mar 2018 at 10:47 PM.
ferrety is offline   Reply With Quote

Old 28 Mar 2018, 02:51 PM   #2
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,317
Arrow Rejection of specified messages

Yes, this is possible. But you should be very careful about such rules, since you can block desired messages if you are not careful. Here are the steps:
  • Go to Settings>Rules and at the bottom right click Edit custom sieve code.
  • In the first (Insert sieve code here) block (before the ### 1. section) enter sieve code similar to the following:
    Code:
    if address :domain :is ["X-Mail-from"] ["marketplace.amazon.co.uk","example.org"]
    {
      reject "Mailbox does not exist";
      stop;
    }
  • Click Save at the top.
Any incoming message sent from any domain in the square brackets will be rejected (and discarded so it does not appear in your Fastmail mailbox). You can place one or more domains (in double quotes as shown) to be rejected in the square brackets. Be sure to look at the raw message and examine the X-Mail-from header in existing emails sent from the domain you want to block and use the exact domain shown (everything after but not including the @). If you use more than one domain you need to separate them with a comma as shown. A reject message will be sent to the sender as follows:
  • From: Mail Sieve Subsystem <postmaster@messagingengine.com>
  • To: (the From or possibly another reply-to address used by the original sender)
  • Subject: Automatically rejected mail
  • Message body:
    Code:
    Your message was automatically rejected by Sieve, a mail
    filtering language.  
    
    The following reason was given: 
    Mailbox does not exist
  • The last line of the body is whatever text you place in the reject clause in the sieve code.
  • Two attachments are also returned in the rejection message. One is the original message. The other shows technical details about the rejection.
Bill
n5bb is offline   Reply With Quote
Old 28 Mar 2018, 02:54 PM   #3
ferrety
Member
 
Join Date: Mar 2018
Posts: 40
Quote:
Originally Posted by n5bb View Post
Yes, this is possible. But you should be very careful about such rules, since you can block desired messages if you are not careful. Here are the steps:
  • Go to Settings>Rules and at the bottom right click Edit custom sieve code.
  • In the first (Insert sieve code here) block (before the ### 1. section) enter sieve code similar to the following:
    Code:
    if address :domain :is ["X-Mail-from"] ["marketplace.amazon.co.uk","example.org"]
    {
      reject "Mailbox does not exist";
      stop;
    }
  • Click Save at the top.
Any incoming message sent from any domain in the square brackets will be rejected (and discarded so it does not appear in your Fastmail mailbox). You can place one or more domains (in double quotes as shown) to be rejected in the square brackets. Be sure to look at the raw message and examine the X-Mail-from header in existing emails sent from the domain you want to block and use the exact domain shown (everything after but not including the @). If you use more than one domain you need to separate them with a comma as shown. A reject message will be sent to the sender as follows:
  • From: Mail Sieve Subsystem <postmaster@messagingengine.com>
  • To: (the From or possibly another reply-to address used by the original sender)
  • Subject: Automatically rejected mail
  • Message body:
    Code:
    Your message was automatically rejected by Sieve, a mail
    filtering language.  
    
    The following reason was given: 
    Mailbox does not exist
  • The last line of the body is whatever text you place in the reject clause in the sieve code.
  • Two attachments are also returned in the rejection message. One is the original message. The other shows technical details about the rejection.
Bill
You are a genius, I'll not be able to try this till later today. I'll be back
ferrety is offline   Reply With Quote
Old 28 Mar 2018, 03:14 PM   #4
ferrety
Member
 
Join Date: Mar 2018
Posts: 40
Bill
I just tried this (thinking I would mess it up) using a throw away outlook email I'd set up so I could see what they would get back
Sure enough it worked, you sir are fantabulous!
ferrety is offline   Reply With Quote
Old 3 Apr 2018, 05:57 PM   #5
ferrety
Member
 
Join Date: Mar 2018
Posts: 40
Bill
If I want to block more than one domain but want to have them receive different reject reasons can I do it like this? Is there a limit to how many I can do?

if address :domain :is ["X-Mail-from"] ["marketplace.amazon.co.uk"]
{
reject "Unwanted Spam From Amazon Marketplace seller";
stop;
}


if address :domain :is ["X-Mail-from"] ["trustpilot.com"]
{
reject "Trustpilot are not authorised to have this email address";
stop;
}
ferrety is offline   Reply With Quote
Old 4 Apr 2018, 03:57 AM   #6
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 2,602
Quote:
Originally Posted by ferrety View Post
Bill
If I want to block more than one domain but want to have them receive different reject reasons can I do it like this? Is there a limit to how many I can do?

if address :domain :is ["X-Mail-from"] ["marketplace.amazon.co.uk"]
{
reject "Unwanted Spam From Amazon Marketplace seller";
stop;
}


if address :domain :is ["X-Mail-from"] ["trustpilot.com"]
{
reject "Trustpilot are not authorised to have this email address";
stop;
}
You can do that. There is no practical limit on the length of the sieve snippets you can write.
BritTim is offline   Reply With Quote
Old 4 Apr 2018, 02:04 PM   #7
ferrety
Member
 
Join Date: Mar 2018
Posts: 40
Quote:
Originally Posted by BritTim View Post
You can do that. There is no practical limit on the length of the sieve snippets you can write.
Really appreciated I've been googling it for days
ferrety is offline   Reply With Quote
Old 4 Apr 2018, 02:21 PM   #8
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,317
Arrow Automated reject messages are usually a bad idea

I just realized that I made a mistake in my earlier instructions. You should insert the sieve reject code in the second user sieve block (after the ### 3. Sieve generated for spam protection block). In general, it's a bad idea to automatically respond to messages which trigger the spam filter, so you want your reject sieve code after the spam filter. The reason will be described later in this post.

Yes, you can respond to multiple From sending domains as you described with different response messages. But you might not want to send all of those reject messages back to the senders. Consider several types of messages you could receive from those sending domains:
  • Spoofed From address:
    • Blatant spammers and those sending phishing messages and malware will often use a fake From address.
    • They don't want you to respond to them via email. They want you to click a link, open an attachment, or follow some instructions in the message (such as buying a penny stock). They are only sending, and have no need to receive email for their purposes.
    • So the bad guys use a spoofed (fake) From address which is less likely to be blocked as spam. They might happen to use a From domain you are rejecting. So your rejection messages might be returned to innocent people whose email domain happens to be one you reject.
    • This can lead in some cases to your email address, your email domain, or the SMTP server you send from being blocked. The block could be at that one domain, or in severe cases it could make it to blacklists or greylists of some type.
    • This is why you need to place the reject sieve code after your spam filter (and always use the Fastmail spam filter). If a message is classified as spam, you want to ignore the message and never respond to it!
  • Automated message sent to you from a sender who is moderately trustworthy.
    • Your reject message will probably be ignored. So why send it, since it might be a spoofed spam message as I described above?
    • If there is an Unsubscribe procedure at the bottom of the message, you can use that procedure. I would check the authentication headers in the message and see if it appears to be truly from the supposed From source before clicking any links in the message.
  • Manually created message sent to you from a sender who is moderately trustworthy.
    • You suspect the sender will actually read your response. In this case, a manual or automatic response to the sender might be appropriate.
In nearly all cases, I think it's better to discard such messages rather than reject them with an automated reply. The rejection message might make you think you are getting back at the sender, but in nearly all cases a rejection reply will potentially hurt you more than the sender.

Bill
n5bb is offline   Reply With Quote
Old 4 Apr 2018, 02:33 PM   #9
ferrety
Member
 
Join Date: Mar 2018
Posts: 40
Quote:
Originally Posted by n5bb View Post
I just realized that I made a mistake in my earlier instructions. You should insert the sieve reject code in the second user sieve block (after the ### 3. Sieve generated for spam protection block). In general, it's a bad idea to automatically respond to messages which trigger the spam filter, so you want your reject sieve code after the spam filter. The reason will be described later in this post.

<snip>

Bill
I appreciate your input thank you again
I absolutely do NOT want this going to spam though. I absolutely DO want to see them get a personalised reject message. So it will work if I put it before the ### 1. section right?

Last edited by ferrety : 4 Apr 2018 at 04:09 PM.
ferrety 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 05:53 AM.

 

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