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 7 Oct 2017, 03:55 PM   #16
FromLine
The "e" in e-mail
 
Join Date: Jan 2002
Posts: 2,619
Quote:
Originally Posted by BritTim View Post
If all else fails, you can achieve similar results by means of a vacation response. Just replace "reject" in your code with "vacation".
This is by no means a solution. This will occur with every email address that I receive email at (and I have many) and will not be the same as a bounce.

I want one specific sender, or a specific domain, to get a bounce message, believing it's an INVALID Email address.

Is it not possible to do a bounce?
FromLine is offline   Reply With Quote
Old 7 Oct 2017, 06:09 PM   #17
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 3,084
Quote:
Originally Posted by FromLine View Post
This is by no means a solution. This will occur with every email address that I receive email at (and I have many) and will not be the same as a bounce.

I want one specific sender, or a specific domain, to get a bounce message, believing it's an INVALID Email address.

Is it not possible to do a bounce?
I think you are misunderstanding what I suggest. I am not recommending you give a vacation response to every sender. I am suggesting you use vacation response only under exactly the same conditions you are trying to use a reject:
Code:
if header :contains ["From", "X-Mail-from", "Return-Path"] "xxxx.da.gov" {
  vacation "Message rejected because Invalid Email Recipient";
  fileinto "INBOX.cdrom"; stop;
}
As I mentioned before, if you want the sender to receive the vacation response more frequently than once every three days (the FastMail default) refer to the documentation for the vacation extension.
BritTim is offline   Reply With Quote
Old 8 Oct 2017, 04:01 AM   #18
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,916
Arrow Reject action discards message

I think that the only solution is a vacation message. As long as you have a spam filter activated, Fastmail supports the reject Sieve action. But Sieve does not allow you to both reject and save a particular message. If the message is rejected then it’s not possible to save a copy.

You could also reject the message with the understanding that the message will be discarded after it is rejected. The reason your earlier examples failed is that you must only use the reject action and not try to include a fileinto action.

Bill
n5bb is offline   Reply With Quote
Old 8 Oct 2017, 05:07 AM   #19
BritTim
The "e" in e-mail
 
Join Date: May 2003
Location: mostly in Thailand
Posts: 3,084
Although I suspect that would also fail, the combination of a redirect and a reject might be worth trying. The sieve code would be something like
Code:
if header :contains ["From", "X-Mail-from", "Return-Path"] "xxxx.da.gov" {
  redirect :copy "me@another.com"
  reject "Message rejected because Invalid Email Recipient";
  stop;
}
Not tested!

Possibly worth trying as the redirect may be processed at SMTP time.
BritTim is offline   Reply With Quote
Old 8 Oct 2017, 05:36 AM   #20
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,916
Arrow Using reject discards original message

That fails. The message is not redirected, the reject message is not sent, and the original incoming message appears in your Inbox. I tried various things before my post stating that you can’t reject and save the original message.

The only possibility I can imagine would be to use an alias (not the main account address) and set more than one target delivery address. This creates two or more separate messages which are separately delivered to your account. You should then be able to use sieve rules so that one message is delivered to some folder or Inbox on your account while the other generates the reject message. But this could get very messy. I will try to test this technique later this weekend if have some time.

In general you need to be very careful about post-SMTP bounces back to the sender, since these can lead to backscatter spam. In addition, if the original sender has a vacation response activated you might bounce their automatic response back to them. If they had a reject system like yours, then without some way to count the messages an infinite email loop might be created, which the two email systems exchanging bounces. This might lead to one or both accounts being temporarily closed by the email providers.

My suggestion is to just tell those people not to use your personal email address from their work account. If you feel strongly about this, you can discard all incoming mail from that domain. Or send a bounce to message sent from that domain, including a comment that their message was discarded and won’t be read.

Bill
n5bb is offline   Reply With Quote
Old 8 Oct 2017, 08:38 AM   #21
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,916
Arrow Multiple alias targets allows message to be both bounced and kept

As I suspected, you can use alias targeting to both reject ("bounce") certain messages and keep those messaged in your account. Here is how to do this:
  • You must receive these messages at an alias address. This could be at your private domain or a Fastmail domain. Go to the Settings>Aliases address you will use and add a second target Deliver to address with the addition of +reject before the @. For example, if your main account address was jcitizen@fastmail.com, you would use two target Deliver to addresses for that alias as follows (assuming you want normal delivery to Inbox):
    • jcitizen@fastmail.com
    • jcitizen+reject@fastmail.com
  • Then add the following in the first block of custom Sieve script:
    Code:
    if allof (
      header :contains ["From", "X-Mail-from", "Return-Path"] "xxxx.da.gov",
      header :contains ["X-Resolved-to"] ["jcitizen+reject@fastmail.com"] 
    ) {
      reject "Please don't use this address!";
      stop;
    }
    elsif header :contains ["X-Resolved-to"] ["jcitizen+reject@fastmail.com"] {
      discard;
      stop;
    }
  • When a message from the gov address is received, the sender will receive a reject message as follows:
    • From: Mail Sieve Subsystem <postmaster@messagingengine.com>
    • Subject: Automatically rejected mail
    • Body: Your message was automatically rejected by Sieve, a mail filtering language.

      The following reason was given:
      Please don't use this address!
    • Two attachments are included. One is the original message. The second (named Attachment2) contains the message disposition status. It will be similar to:
      Reporting-UA: sloti22d1t13; Cyrus fastmail-fmjessie45441-15552-git-fastmail-15552/CMU Sieve 3.0
      Original-Recipient: rfc822; <Original destination address>
      Final-Recipient: rfc822; Ys555yY76QL5/Gi34eksvyyKoFA87Wrd33cLPI5cQS 15444113573
      Original-Message-ID: <1507331572.631740.1131244464.466GH196@webmail.messagingengine.com>
      Disposition: automatic-action/MDN-sent-automatically; deleted
    • A copy of the message will be placed in your Inbox..
  • If you receive a normal incoming message to that alias (not from the gov From address), the elseif... clause in the rule will discard the message delivered with +reject. But the normally targeted message will be delivered since my rule will be ignored.
I have tested the Sieve rule I posted above (with a different From and my own alias) and it works correctly. But other Sieve rules (automatic or manual) could interact with this rule, so be sure to test it before trusting it.

Bill
n5bb is offline   Reply With Quote
Old 8 Oct 2017, 10:45 AM   #22
gardenweed
Cornerstone of the Community
 
Join Date: Jun 2008
Location: Perth
Posts: 664
Nice solution Bill.
I always learn something when I read your posts.
gardenweed is offline   Reply With Quote
Old 8 Oct 2017, 03:50 PM   #23
FromLine
The "e" in e-mail
 
Join Date: Jan 2002
Posts: 2,619
........................
FromLine is offline   Reply With Quote
Old 8 Oct 2017, 04:06 PM   #24
FromLine
The "e" in e-mail
 
Join Date: Jan 2002
Posts: 2,619
Quote:
Originally Posted by n5bb View Post
As I suspected, you can use alias targeting to both reject ("bounce") certain messages and keep those messaged in your account. Here is how to do this:[list][*]You must receive these messages at an alias address. This could be at your private domain or a Fastmail domain. Go to the Settings>Aliases address you will use and add a second target Deliver to address with the addition of +reject before the @. For example, if your main account address was jcitizen@fastmail.com, you would use two target Deliver to addresses for that alias as follows (assuming you want normal delivery to Inbox):
  • jcitizen@fastmail.com
  • jcitizen+reject@fastmail.com
I'm using my own domain and it's not working.

I can't add the following alias:

adam+reject@MyVirtualDomain.com

See this image:

https://i.imgur.com/5WwfHZM.jpg

Clearly, FM does not allow this using a non-FM domain.

This is being sent to a non-FM domain, and FM does not allow me to add

alias+reject

or

alias+ anything

The + sign is not allowed.
FromLine is offline   Reply With Quote
Old 8 Oct 2017, 04:26 PM   #25
FromLine
The "e" in e-mail
 
Join Date: Jan 2002
Posts: 2,619
The "reject" is not a bounce

Using this simply code:

Code:
if header :contains ["From", "X-Mail-from", "Return-Path"] "thing95@gmail.com" {
  reject "Message rejected because Invalid Email Recipient";
}
Here's the reply which took almost a minute:

See image:

https://i.imgur.com/aAjMMfy.jpg

------------

Your message was automatically rejected by Sieve, a mail
filtering language.

The following reason was given:
Message rejected because Invalid Email Recipient

-----------------

There are no attachments.

They don't get a true bounce reply, rather a message telling them that I set up a Sieve, a "filtering language".

This is not a bounce, I can't get the allof code above to work, and I'm still trying to find a way to bounce a message from a specific sending domain.
FromLine is offline   Reply With Quote
Old 8 Oct 2017, 04:32 PM   #26
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,916
Quote:
Originally Posted by FromLine View Post
I'm using my own domain and it's not working.
I can't add the following alias:
adam+reject@MyVirtualDomain.com ...
Please carefully read my earlier comments. The alias itself does not include any + symbol. You need to include two target Deliver to addresses for the alias (which can be an existing alias), and one of those targets needs to include the plus+addressing +reject tag. It doesn't have to be "+reject" and could be "+r" or something else.
Quote:
For example, if your main account address was jcitizen@fastmail.com, you would use two target Deliver to addresses for that alias as follows (assuming you want normal delivery to Inbox):
  • jcitizen@fastmail.com
  • jcitizen+reject@fastmail.com
What's important is that there are two delivery targets so that two slightly different of the incoming message are separately processed by your Sieve script. Here is what happens in my example, assuming that the alias was me@example.org and your Fastmail account name was jcitizen@fastmail.com:
  • An incoming message is sent to the alias me@example.org.
  • A copy of that message is first delivered to jcitizen@fastmail.com. No matter what From address was used by the sender, this copy of the message does not trigger either the if or the elsif conditional clauses so my additional Sieve is ignored. So this copy of the message is delivered to your account in the normal fashion using your other rules.
  • Then a copy of that same message is delivered to jcitizen+reject@fastmail.com.
    • If it is From the gov sender, the first conditional clause is executed and a reject bounce message is generated. Due to the way that Sieve handles the reject action, this copy is not delivered to any of your folders (or the remainder of the Sieve script).
    • If it is not from the gov sender, the second conditional clause is executed and this copy of the message is not delivered to your account. But remember that the first copy was already delivered, so this is the desired behavior.
Bill
n5bb is offline   Reply With Quote
Old 8 Oct 2017, 04:40 PM   #27
FromLine
The "e" in e-mail
 
Join Date: Jan 2002
Posts: 2,619
...................................
FromLine is offline   Reply With Quote
Old 8 Oct 2017, 04:51 PM   #28
FromLine
The "e" in e-mail
 
Join Date: Jan 2002
Posts: 2,619
Quote:
Originally Posted by n5bb View Post
You need to include two target Deliver to addresses for the alias (which can be an existing alias), and one of those targets needs to include the plus+addressing +reject tag. It doesn't have to be "+reject" and could be "+r" or something else.
I have set up two targets as follows:

https://i.imgur.com/8dcHMov.jpg

It is still not working.

Here is the code I'm using:

Code:
if allof (
  header :contains ["From", "X-Mail-from", "Return-Path"] "gmail.com",
  header :contains ["X-Resolved-to"] ["adam+reject@axxxxx.com"] 
) {
  reject "Please don't use this address!";
  stop;
}
elsif header :contains ["X-Resolved-to"] ["adam+reject@axxxxx.com"] {
  discard;
  stop;
}
The result:

Email goes into my inbox.

No return message to sender @gmail.com
FromLine is offline   Reply With Quote
Old 8 Oct 2017, 04:59 PM   #29
FromLine
The "e" in e-mail
 
Join Date: Jan 2002
Posts: 2,619
Question

Quote:
Originally Posted by n5bb View Post
* If it is From the gov sender, the first conditional clause is executed and a reject bounce message is generated.
At this time, I'm using "gmail.com" instead xxxx.ca.gov to test.

Sending from a Gmail account (a "gmail.com" address) and not getting a bounce message at gmail.

Again, here's the code I'm using:

Code:
if allof (
  header :contains ["From", "X-Mail-from", "Return-Path"] "gmail.com",
  header :contains ["X-Resolved-to"] ["adam+reject@axxxxx.com"] 
) {
  reject "Please don't use this address!";
  stop;
}
elsif header :contains ["X-Resolved-to"] ["adam+reject@axxxxx.com"] {
  discard;
  stop;
}
Why is the sender, from gmail.com, not getting a bounce?
FromLine is offline   Reply With Quote
Old 8 Oct 2017, 04:59 PM   #30
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,916
When I test my Sieve script example modified for my Gmail From address, I get the correct behavior. If I look at the original (raw) message contents which are received at Gmail due to the rejection, the rejection message has a 3-part mulitipart MIME body. Gmail displays this differently than Fastmail to the user if you don't look at the raw message.

For your latest example to work, your Fastmail account main login address must be adam@axxxxx.com and you must have some alias which has two delivery targets:
  • adam@axxxxx.com
  • adam+reject@axxxxx.com
However, your image indicates that your Fastmail account is at the fastmail.com domain. Please carefully read my earlier messages and note that the Sieve script does not use any portion of your alias. The two target (Deliver to) addresses entered for your alias are targets at your Fastmail account login address, and the Sieve script contains your Fastmail account main (login) address with +reject.

Bill
n5bb 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 10:27 PM.

 

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