I have seen a number of different paths, but, it is a bit confusing to me. What should be in my value in the HIDDEN input action below?
I have a twig page at my root:
<form method="post" action="" accept-charset="UTF-8">
<input type="hidden" name="action" value="psychEmail/pubRequest">
<!-- ...-->
<input class="btn submit" type="submit" value="{{ 'Submit'|t }}">
</form>
and then I have a plugin PsychEmailPlugin.php
class file with
class PsychEmailPlugin extends BasePlugin
and then I have a controllers subdirectory with a PsychEmailController.php
file that contains an action:
class PsychEmailController extends BaseController
{
public function actionPubRequest($emailAddress)
{
$email = new EmailModel();
$email->fromEmail = $emailAddress;
$email->toEmail = '[email protected]';
$email->subject = 'Publication Request';
$email->body = 'Your requested publication is attached.';
craft()->email->sendEmail($email);
}
}