by Souptik Datta on WordPress.org

WordPress Options (Email)
Check out the Github Repository ♥
Limitless Communication: All-in-one, super scalable, messaging Solution for WordPress.
Ok hold on! ✋. So, many words in one line.
Let’s understand each one-by-one.
xyz provider for SMS, I want to use pqr, can I have that? Yes it provides you with lot of pre implemented providers for all email, sms and push-notification.yxr you haven’t heard the name of. Now what? 🧐
And that’s how it provides Limitless communication! 🚀
Setup ⚙️ | Issues | Services and functions 🧩 | Create your own Adapter 🛠️
Send an email through a particular adapter (with headers 😉) –
\Souptik\AllPathMessaging\Email\send(
[ 'dev2@souptik.dev' ],
'Yay its working!',
'This is some long mail body.',
'Souptik',
'dev1@souptik.dev',
[
'cc' => [
[
'name' => 'CC Test',
'email' => 'cc@souptik.dev',
],
],
'attachments' => [
trailingslashit( WP_CONTENT_DIR ) . '/mu-plugins/test-all-path-messaging.php',
'SameFileDifferentName.php' => trailingslashit( WP_CONTENT_DIR ) . '/mu-plugins/test-all-path-messaging.php',
],
],
'mailgun'
);
Just remove the last parameter! And now it uses the default selected adapter –
\Souptik\AllPathMessaging\Email\send(
[ 'dev2@souptik.dev' ],
'Yay its working!',
'This is some long mail body.',
'Souptik',
'dev1@souptik.dev',
[
'cc' => [
[
'name' => 'CC Test',
'email' => 'cc@souptik.dev',
],
],
'attachments' => [
trailingslashit( WP_CONTENT_DIR ) . '/mu-plugins/test-all-path-messaging.php',
'SameFileDifferentName.php' => trailingslashit( WP_CONTENT_DIR ) . '/mu-plugins/test-all-path-messaging.php',
],
],
);
Checked the override wp_mail checkbox? Try a simple wp_mail! –
wp_mail(
[ 'dev2@souptik.dev' ],
'Yay its working!',
'This is some long mail body - from wp_mail.',
[],
[]
);
Send a SMS through a particular adapter –
\Souptik\AllPathMessaging\SMS\send( [ '+xxxxxxxxxxxx' ], 'Yay its working!', 'twilio' );
Just remove the last parameter! And now it uses the default selected adapter –
\Souptik\AllPathMessaging\SMS\send( [ '+xxxxxxxxxxxx' ], 'Yay its working!' );
Here comes the cool part fellow developers! 💻
Tip: I have provided a dummy adapter for each service at inc/.
Consider that as the starting point and let’s understand what each file does.
namespace.php. It is the entry point of your adapter.
bootstrap function.EMAIL_SLUG . '_adapters' and registering our adapter.slugnameadapter class object.options – An array defining the settings required for this adapter, which will be used to automatically display the options on the settings page.class-adapter.php, which is the Adapter class, which we initialized in the above file and passed it to adapter. It contains three simple functions –
get_settings_fields – This is the function which returns the array of options, which we used in the above file for options. Each option, will have –label – Label to display in the settings page beside the input.type – Type of the field.sanitize_callbackget_settings – This function returns an associative array, whose keys are the name of the options and the value as the value of the options.get_adapter – This function will just return the core provider class, which is responsible for processing the message.Utopia Messaging already provides the provider or not here, for example Utopia\Messaging\Adapter\Email\Mailgun.Utopia Messaging makes it so easy to create a new adapter!class-dummy.php is for that purpose, assuming you don’t get a provider already present in Utopia Messaging.
EmailAdapter or SMSAdapter, which abstract a lot of stuff for us!_construct and process. Rest of the functions and properties are self-explanatory! 😉_construct function just put the arguments which you want to accept. That’s it! And now they will be available everywhere else as $this->param_name!process function is the place where you have to write the main logic of calling your providers API to send the message.
$this->param_name.body and the headers.$this->request function as demonstrated in the dummy!Response class.This plugin connect’s to Brevo’s API to send emails through Brevo. This is the API it sends the request to.
The request is send everytime a mail is sent, and Brevo is selected as the default adapter from the plugin settings (or the function to send email through Brevo is directly invoked in the code).
Here is the Terms of Use and Privacy Policy of the service.
This plugin connect’s to AWS SES’s API to send emails through AWS SES.
The request is send everytime a mail is sent, and AWS SES is selected as the default adapter from the plugin settings (or the function to send email through AWS SES is directly invoked in the code).
Here is the Terms of Use and Privacy Policy of the service.
This plugin connect’s to Mailgun’s API to send emails through Mailgun.
The request is send everytime a mail is sent, and Mailgun is selected as the default adapter from the plugin settings (or the function to send email through Mailgun is directly invoked in the code).
Here is the Terms of Use and Privacy Policy of the service.
This plugin connect’s to Telesign’s API to send SMS through Telesign.
The request is send everytime the function to send SMS is invoked with the Adapter as Telesign or the default adapter is set as Telesign.
Here is the Terms of Use and Privacy Policy of the service.
This plugin connect’s to Twilio’s API to send SMS through Twilio.
The request is send everytime the function to send SMS is invoked with the Adapter as Twilio or the default adapter is set as Twilio.
Here is the Terms of Use and Privacy Policy of the service.