Am 12.08.2011 um 21:05 schrieb Thomas Bruederli:
On Tue, Aug 9, 2011 at 17:15, Florian Mutter elm@skweez.net wrote:
I would like to write a plugin that enables the user to specify an external SMTP server for every identity. But there are some questions I got.
I startet and used the identity_form hook to inject the additional form elements, but how am I supposed to get the values that were entered by the user? identity_update and identity_create do not provide the additional data to my plugin. And of course the data is not saved automatically.
To get the submitted data simply use $_POST['myvar'] or better get_input_value('myvar', RCUBE_INPUT_POST);
Second question: When I get the data, how is a plugin supposed to save data? Do I save the data with:
rcmail::get_instance()->user->save_prefs(array('key' => $value));
or is there a way to save the data right where the identity is saved?
This is up to the plugin developer... either you use user prefs or you extend the identities database table. With the latter option you can copy the submitted data right into the 'record' property of the 'identity_update' hook and they'll be stored with the identities record.
Since Roundcube doesn't (yet) provide an install routine or script for plugins, you have to mention the schema changes in a README file and hope that people read it :-)
Regards, Thomas
Thank you for your help. Here is the next question:
How is the plugin supposed to now which identity was used to send an email? the smtp_connect hook doesn't provide the identity that was used to send a message nor does it provide an email address or message ID. I think there should be a message ID which invoked the smtp_connect hook that can be used to determine additional informations about the mail that is about to be sent. I hope you, or someone else, can help me.
Greetz elm
List info: http://lists.roundcube.net/dev/ BT/aba52c80