A plugin that simplifies the implementation of opt-in process for any input forms.
This is a Plugin for developers, as you will need to provide your own template-files.
This plugin requires Craft CMS 4.0.0 or later
cd /path/to/my-project.test
composer require misterbk/optinmail
./craft install/plugin opt-in-mail
To get this plugin to work, you need to create or link your own template files.
To do this, please open the Controll-Center setup page in the admin section of Craft:
"Settings > Plug-ins > Opt In Mail"
Set the path to all three template files. An example is provided in the examples-folder of this plugin.
You can see how to access the variables provided in these views and see example implementations of the emails/sites
To prevent database-injection you have to provide "qualified field names", which means, that you whitelist the fields you
want to accept in the form you want to connect with an opt-in-procedure.
Just add the names of your input fields under the corresponding formHandle in the "opt-in-mail.php file". You find this file under: "config/opt-in-mail.php"
If that file does not exist, you can copy our example config file from "craft-plugin-optInMail/src/examples/opt-in-mail.php" to Craft's config folder and add your field names there.
When everything is set up you can connect your form to the plugin by adding a hidden input field to your form with the following format:\
<input name="action" type="hidden" value="opt-in-mail/form/save-form-data">
<input type="hidden" name="optInFormHandle" value="{{handle}}">
whereas {{handle}} is the formHandle you provided in the "opt-in-mail.php" config file in step 2
If Craft's mailing settings are set you can submit your form and see if you receive the opt-in-mail.
This is one of our first Plug-ins for Craft 3, so we rely on your feedback. If you have any suggestions or found any bugs, please contact us over our Github-Account : https://github.com/mister-bk or via email: mister-bk!