Hello modernmagic,
I'll try to help you with a simple example.
The purpose here is that after the submission of your form, you must request the database to get the email of the category author and then send the email, so:
- get the category submited
- get the author of the category
- get the email of the author
- send an email to this author email
For that we will use the plugin field Code "Afterstore".
In this kind of field, we can read the array "$fields" which is the array of all fields in your form.
Getting the category
$catid = $fields['name_of_category_field']->value;
Getting the category author
$cat_author = JCckDatabase::loadResult( 'SELECT created_user_id FROM #__categories WHERE id ='.$catid );
Getting his email
$author_email = JCckDatabase::loadResult( 'SELECT email FROM #__users WHERE id ='.$cat_author );
and finaly, send the email to the author
For that, you can use the Joomla! framework, and specifically the sendMail function:
$app = JFactory::getApplication();
$attach = array();
$from = $app->getCfg( 'mailfrom' );
$fromName = $app->getCfg( 'fromname' );
$dest = array( $author_email );
$subject = 'The subject'; // you can get the subjetc from a field $fields['xxx']->value;
$body = 'The body'; // you can get the subjetc from a field $fields['xxx']->value;
$bool = JFactory::getMailer()->sendMail( $from, $fromName, $dest, $subject, $body, true, NULL, NULL, $attach, NULL, NULL );
Regards.
Lionel