Author Topic: [SOLVED] Show real sender for shared "Sent Items" folder  (Read 10857 times)

Offline mkrc21

  • Newbie
  • *
  • Posts: 2
[SOLVED] Show real sender for shared "Sent Items" folder
« on: April 11, 2021, 06:43:07 AM »
Hello,

I've configured RC to support shared folders (acl plugin together with dovecot) - which works perfectly.

But I'm searching for a way to display the real sender in the "fromto" for emails shown in a shared "Sent Items" folder, instead
of the user's email sharing this folder.

To clarify:

1) user@mail.com is sharing his Sent Items folder

2) other-user@mail.com subscribed to user@mail.com's shared Sent Items

3) Instead of the real sender other-user@mail.com always sees user@mail.com as sender for emails in the Sent Items folder


Can somebody please direct me in a way to solve this issue?

I'm glad to write a plugin - but I currently don't have a good starting point.

Ideally, the sender should only be adapted for subscriptions to shared "Sent Items" folders.

Thanks a lot.
« Last Edit: April 11, 2021, 12:48:37 PM by mkrc21 »

Offline mkrc21

  • Newbie
  • *
  • Posts: 2
Re: Show real sender for shared "Sent Items" folder
« Reply #1 on: April 11, 2021, 12:48:02 PM »
Already found a solution after checking the plugin hooks.

I am using the messages_list hook for a custom plugin which works (surprise, suprise) as it should and I'm able
to change the sender accordingly.

Great, if something documented just works :)

In case you are interested here's the code:

Code: [Select]
<?php

/**
 * Displays actual sender for e-mails in shared Sent folder.
 *
 * @author Matthias Kerstner
 */
class show_actual_sender_for_shared_sent_folder extends rcube_plugin
{
public $task 'mail';

    function 
init()
    {
        
$this->add_hook('messages_list', array($this'do_show_actual_sender_for_shared_sent_folder'));
    }

    function 
do_show_actual_sender_for_shared_sent_folder($args)
    {
        
$this->load_config();

foreach($args['messages'] as $msg) {   
  if(preg_match('#^shared\/[^\/]+\/Sent( Items)?$#'$msg->folder)) {
$msg->from $msg->to;
  }
}

        return 
$args;
    }
}
« Last Edit: April 11, 2021, 01:05:10 PM by mkrc21 »