jimderonde / wp-mailer
Composer package for Gewest13's Wordpress mailer.
Installs: 301
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 1
pkg:composer/jimderonde/wp-mailer
Requires
- phpmailer/phpmailer: ^6.1
- vlucas/phpdotenv: ^4.1
This package is auto-updated.
Last update: 2025-10-14 13:00:44 UTC
README
This is a Wordpress module developed by Jim de Ronde (Gewest13).
Prerequisites
- ACF Pro
Installation
Do this first.
- Clone the repository in your
server/directory. - Do a
composer installinside the folder. - Require or include the
server/wp-mailer/autoload.phpinto yourfunctions.phpfile. - Please note that a hook within Wordpress is including a javascript file into the footer. Import it as you like whenever you desire a bundle over multiple javascript files.
When this is done a first form can be added.
- Create a
.envfile in the root of your template folder with the credentials as presented in the example file.example.env. - Create a new form and add any field to your liking.
- Add the
/sample-component/to your list of components/. Please note that the form will require some predefined settings like anaction,data-wp-mailerandmethod. - At last, please include
wp_footer()before the ending of your</body>tag. Please not that the entire function will be cleared and will only return the javascript file that will take care of the asynchronous requests. - If desired, add the following rule to your
.cssfile in order to hide the badge:.grecaptcha-badge {display: none}
Functions
Always check if $mailer is a valid instance of the Mailer class.
- Use
$mailer->getForm($id)to get all form fields. - Then, use a
foreachloop to loop through all fields.foreach ($mailer->getForm($id) as $name => $field). - Inside the loop the
$field->fieldvariable will contain the entire html element so use$mailer->parseField($field->field, "classes")to parse it. - Label can be accessed through
$field->label. - Name can be accessed through
$field->name. - Field type can be accessed through
$field->type.