Getting Started

Mail providers determine how WHASOLS transmits email to admins and their customers.
Sample Module
The SenderModuleInterface interface for mail providers ships with WHASOLS.
Choosing A Name
Mail provider modules are in the modules/emailers directory. Each module has its own subdirectory, which you should use to store the files relating to the module.
Mail provider modules are PHP files that contain api code that implements the SenderModuleInterface interface.
To create a new mail provider module, perform these steps:
  1. Choose a name for your module. Module names must be a single string that consists of only alphanumeric characters (no spaces or other characters). Names must begin with a letter and must be unique.
  2. Create a new directory using your desired module name.
  3. Create a new file within the directory, using your module name as the filename and the .php extension.
  4. Add the following code to the file, replacing YourModuleName with the name of your module:
<?php
function yourmodule_config()
{
	$configarray = [
	"name" => "Your Module Name",
	"description" => "Your Module Description",
	"version" => "1",//Your Module Version Number
	"author" => "Author Name",
	"author_url" => "https://your domain name.com/",
	"language" => "english",
	"configs" => [ // Configuration fields 
	     'api_username' => [
	                    "Name" => "API Username",
	                    "Type" => "text",
	                    "Description" => "The required username to authenticate with messaging service.",
	                     ],
	     'api_password' => [
	                    "Name" => "API Password",
	                    "Type" => "password",
	                    "Description" => "The required password to authenticate with messaging service.",
	                   ],
	        "isenable" => [ //checkbox Button
	                "Name" => "Enable mod?", 
	                "Type" =>  "yesno", 
	                "Size" => "55", 
	                "Description" => "A quick way to enable or disable this module on your website ", 
	                "Default" => "", 
	            ],
	        "dropdown" => [ //Dropdown Select box
	                "Name" => "Select Box", 
	                "Type" =>  "dropdown", 
	                "Options" => "1,2,3,4,5,6,7,8", 
	                "Description" => "Dropdown Description here", 
	                "Default" => "1", 
	            ],
	        "radiobox" => [ //Dropdown Select box
	                "Name" => "Radio button", 
	                "Type" =>  "radio", 
	                "Options" => "1,2,3,4,5,6,7,8", 
	                "Description" => "Radio buttons Description here", 
	                "Default" => "1", 
	            ],
	        ],
	    ];
	return $configarray;
}
function yourmodule_send($params=[], $mailData=[])
{
    $params have API Configuration Information
    $Subject= $mailData["Subject"];
    $Body= $mailData["Body"];
    $ClientId = $mailData["ClientId"];
    $From= $mailData["From"];
    $FromEmail= $From["Email"];
    $FromName= $From["Name"];
    $ReplyTo= $mailData["ReplyTo"];
    $ReplyToEmail= $ReplyTo["Email"];
    $ReplyToName= $ReplyTo["Name"];
    $AddressTo= $mailData["AddressTo"]; //Array = Email sent to "address to", AddressTo is an Array which have Email and Name information.
    $Cc= $mailData["Cc"]; //Cc Array = Emails of CC.
    $Bcc= $mailData["Bcc"]; //BccArray = Emails of Bcc.
    $Attachments= $mailData["Attachments"]; //Attachments Array= Which have file and name information
    //Your API Code here
   if($mailSent == true)
   {
       return ["status"=>"success","message"=>"Email sent successfully"];
   }
   else
   {
       return ["status"=>"error","message"=>"Error Reponse from API here"];
   }
}