Author Topic: How to get To/Cc/Bcc fields in rcmail  (Read 6332 times)

Offline bocode

  • Newbie
  • *
  • Posts: 6
How to get To/Cc/Bcc fields in rcmail
« on: January 11, 2010, 05:57:02 AM »
Hi All,

I'm developing a new plugin and i need to get access to To, Cc and Bcc fields in the current composed message. My plugin gets called when "smtp_hook" is acted upon.

Is there a way to get these fields from rcmail instance?

Thanks in advance for the help,
Bo

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
How to get To/Cc/Bcc fields in rcmail
« Reply #1 on: January 11, 2010, 06:09:57 AM »
You could use the 'outgoing_message_headers' hook. Look into my 'limit_recipients' plugin (part of MyRoundcube plugins bundle).
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline bocode

  • Newbie
  • *
  • Posts: 6
How to get To/Cc/Bcc fields in rcmail
« Reply #2 on: January 11, 2010, 06:24:32 AM »
Thank you Rosali. I've actually used some of your code in my plugin, the code you've written is very easy to follow. Hats off to you :-).

Could you please tell me how to get the email id(s) in the To field. Am able to get the number of recipients from your code.

Thanks in advance

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
How to get To/Cc/Bcc fields in rcmail
« Reply #3 on: January 11, 2010, 07:26:15 AM »
What do you mean by email id(s). Do you mean the recipients addresses?


$rcmail 
rcmail::get_instance();
$to $rcmail->imap->decode_address_list($args['headers']['To']);
print_r($to);
Regards,
Rosali
__________________
MyRoundcube Project (commercial)