PHP code example of sahil-gulati / mr-email

1. Go to this page and download the library: Download sahil-gulati/mr-email library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sahil-gulati / mr-email example snippets


$sesEmail = new SESEmail("callback_function","AWSKEYXXXX","AWSSECRET-XXXXXX","us-east-1");

$sesRequestObj=new SESEmailRequest();
$sesRequestObj
    ->addReceiver($receiverEmail) 
    ->addSenderEmail($senderEmail)
    ->addSenderName($senderName)
    ->setContentType("application/json")  //Added in version 2.0.0
    ->setEmailSubject("testing email1!")
    ->setEmailBody("This is a email body")
    ->makeContent();

/**
 * Adding request in SESEmail
 */
$sesEmail->makeRequest($sesRequestObj);

/**
 * Executing gathered request
 */
$sesEmail->execute();
function callback_function($response,$requestNo,$parameters,$groupNo)
{
    print_r(func_get_args());
}


/**
 * Using namespace of MREmail
 */
use MREmail\SESEmail as SESEmail;
use MREmail\SESEmailRequest as SESEmailRequest;

$receiverEmail="[email protected]";
$senderEmail="[email protected]";
$senderName="Sahil Gulati";
/**
 * Note: While sending test email $senderEmail must be equal to $receiverEmail.
 */
$sesEmail = new SESEmail("callback_function","AWSKEYXXXX","AWSSECRET-XXXXXX","us-east-1");
$sesEmail->sendTestEmail($senderEmail);



 Using namespace of MREmail
 */
use MREmail\SESEmail as SESEmail;
use MREmail\SESEmailRequest as SESEmailRequest;

$receiverEmail="[email protected]";
$senderEmail="[email protected]";
$senderName="Sahil Gulati";
/**
 * Initiating object of SESEmail
 * Callback function type
 * (String) `callback_function` global function
 * (Array) array => 0 (Object) $classObject array => 1 (String) function_name(public) 
 * (Array) array => 0 (String) class_name array => 1 (String) function_name(public static) 
 */
$sesEmail = new SESEmail("callback_function","AWSKEYXXXX","AWSSECRET-XXXXXX","us-east-1");
/**
 * Initiating object of SESEmail request 1
 */
$sesRequestObj=new SESEmailRequest();
/**
 * Adding request in SESEmail
 */
$sesEmail->makeRequest(
            $sesRequestObj
            ->addReceiver($receiverEmail)
            ->addSenderEmail($senderEmail)
            ->addSenderName($senderName)
            ->setContentType("application/json")
            ->setEmailSubject("testing email1!")
            ->setEmailBody("This is a email body")
            ->makeContent()
        );
/**
 * Initiating object of SESEmail request 2
 */
$sesRequestObj=new SESEmailRequest();
/**
 * Adding request in SESEmail
 */
$sesEmail->makeRequest(
            $sesRequestObj
            ->addReceiver($receiverEmail)
            ->addSenderEmail($senderEmail)
            ->addSenderName($senderName)
            ->setEmailSubject("testing email2!")
            ->setEmailBody("This is a email body")
            ->makeContent()
        );
/**
 * Initiating object of SESEmail request 3
 */
$sesRequestObj=new SESEmailRequest();
/**
 * Adding request in SESEmail
 */
$sesEmail->makeRequest(
            $sesRequestObj
            ->addReceiver($receiverEmail)
            ->addSenderEmail($senderEmail)
            ->addSenderName($senderName)
            ->setEmailSubject("testing email3!")
            ->setEmailBody("This is a email body")
            ->makeContent()
        );
/**
 * Executing gathered request
 */
$sesEmail->execute();
function callback_function($response,$requestNo,$parameters,$groupNo)
{
    print_r(func_get_args());
}