Re: In a sieve script, how to direct a message to another user's mailbox on the same server?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello @ndy,

thanks for your help again!

On 08.12.2023 18:57, Andy Bennett wrote:
Hi,

fetchmailrc:

poll server.provider.com
proto pop3
user "user_A"
mda "/usr/sbin/cyrdeliver user_A"
We have made an extremely simple sieve test script:

if envelope :is "to" "user_A@xxxxxxxxxxxxx"
{
  fileinto "user/user_B/INBOX/folder_A";
}

The fetchmail config means that the envelope for user_A's messages (i.e. the ones that come from user_A's POP box) will always be user_A (in Cyrus).

Are you sure that the @ourdomain.com domain is correct?

I am semi-sure. Actually, we have other sieve scripts where this method works as expected. We always deliver via cyrdeliver, using the SASL name of the respective mailbox / user, and nevertheless, sieve correctly matches the "envelope" condition if given the fully qualified recipient address. I never have investigated why this is possible; it's weird because there is no header that stores the envelope to address. We just were happy that the filters worked and didn't put a lot of time time into researching why :-)

Motivated by your comment above, I have altered the script and tested again:

if address :matches "to" "*user_A@xxxxxxxxxxxxx*"
{
  fileinto "user/user_B/INBOX/folder_A"
}

This didn't change anything, which means that the problem is indeed somewhere else (I have double checked that the "To:" header in the respective messages contained "user_A@xxxxxxxxxxxxx").

Here is my theory:

The path after "fileinto" is probably relative to the original user's mailbox, not to the global root of the mailbox storage. This would mean that there is no chance to achieve what I want, unless there is another special syntax to get to that root in a "fileinto" action.

To test that theory, I'll probably create the folder structure "user/user_B/INBOX/folder_A" in user A's mailbox. I bet that the respective messages then get sorted into folder_A.

I still would like to know whether anybody ever has managed to "fileinto" a message into another user's mailbox using a sieve filter. As mentioned previously, I have seen several tutorials that claimed sieve to be able to "fileinto" messages into *public* IMAP folders. But I now believe that these articles' authors just have copied each other's statements without ever testing it. If my theory is correct and the folder path that is given to "fileinto" is relative to the respective user's mailbox, then it can't work, regardless of whether the destination should be a public folder or another user's mailbox.

Now we would like to extend the script so that messages to user A are put
into user B's mailbox (INBOX or subfolder thereof) *in addition*, provided
they originated from a certain sender.

After successfully getting the fileinto clause to trigger, remember to mark the message as unseen so that the rules continue to be processed and the message is eventually filed into user_A's INBOX as well.

Thank you very much for the hint. We could eventually also use the :copy modifier with "fileinto". I have yet to investigate which method should be used in which scenario. However, that's a secondary problem. If we don't get the primary problem solved, we'll abandon sieve and try something else.

Best regards,

Binarus

------------------------------------------
Cyrus: Info
Permalink: https://cyrus.topicbox.com/groups/info/Tcc7e409b06bc9bfd-Mab2daf031fc30ce0928d7eb9
Delivery options: https://cyrus.topicbox.com/groups/info/subscription




[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]
  Powered by Linux