At the beginning, i was using the classic apache sendmail to send email from my custom forms. Finaly i decide to use Mailjet o send all: forms submission and transactional email. I install the plugin and it works well.
As Mailjet API is install throught the plugin, i would like to rely on the plugin to send newsletter subscriptions and unsubscriptions, to send automation trigger.
I check the doc: https://dev.mailjet.com/guides/#contactslist_managemanycontacts And notice than i can use:
$apikey = get_option('mailjet_password');
$apisecret = get_option('mailjet_username');
I try tu use ajax and a function similar to the API documentation but it doesn't seems to work:
function sendRegisterNewsletter($list_id, $email, $firstname, $name, $job, $structure) {
$apikey = get_option('mailjet_password');
$apisecret = get_option('mailjet_username');
require '../../plugins/mailjet-for-wordpress/api/mailjet-api-v3.php';
use \Mailjet\Resources;
$mj = new \Mailjet\Client($apikey, $apisecret);
}
I get a error with "use": syntax error, unexpected T_USE use
As i use the plugin, i don't think it was useful to use the module: https://github.com/mailjet/mailjet-apiv3-php
Any advice to use the configured plugin and Mailjet's api? Thank you in advance for any help.
jb