Send Mail

The send method is responsible for delivering mail to the mail provider.

In this method, you should craft an appropriately formatted message and transmit it to the messaging service.

The method receives two input arguments:
$params — An array of configuration parameters for the mail provider.
$mailData — $mailData have Email related all information.


<?php
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"];
   }
}