Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: bocode on January 11, 2010, 05:57:02 AM

Title: How to get To/Cc/Bcc fields in rcmail
Post by: bocode 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
Title: How to get To/Cc/Bcc fields in rcmail
Post by: rosali 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).
Title: How to get To/Cc/Bcc fields in rcmail
Post by: bocode 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
Title: How to get To/Cc/Bcc fields in rcmail
Post by: rosali 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);