( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/sendEmailX/index.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

// require the setup which has registered the autoloader
require_once  'setup.php';





// Get mode (works with GET or POST)
$mode = $_REQUEST['mode'] ?? '';

// Switch between cases
switch ($mode) {
    case 'onboard':
        echo "Onboarding process started.";
        // create the lists endpoint:

        $endpoint = new EmsApi\Endpoint\Lists();


        $listUidOnboarding    = 'gc10198bct8df';
        $endpoint   = new EmsApi\Endpoint\ListSubscribers();

        $mode = $_REQUEST['mode'] ?? '';
          $mode    = $_REQUEST['mode']    ?? '';

          $email = $_REQUEST["email"] ;

        $fname= $_REQUEST["catalogname"] ;
        $lname= "" ;
        $catalogid= $_REQUEST["catalogid"] ;
        $catalogname= $_REQUEST["catalogname"] ;
        $id= $_REQUEST["id"] ;
        $newsletter= 0 ;
        $website= $_REQUEST["website"] ;
        $phone= $_REQUEST["phone"] ;
        $type= $_REQUEST["type"] ;
        $name= $_REQUEST["name"] ;
        $country= $_REQUEST["country"] ;
        $oauth_provider= $_REQUEST["oauth_provider"] ;
        $timestamp= $_REQUEST["timestamp"] ;
        $creator= $_REQUEST["creator"] ;

        // You can put your onboarding logic here



        $response   = $endpoint->create($listUidOnboarding, [
            'EMAIL' => $email,
            'FNAME' => $fname,
            'LNAME' => $lname,
            'CATALOGNAME' => $catalogname,
            'CATALOGID' => $catalogid,
            'ID' => $id,
            'NEWSLETTER' => $newsletter,
            'WEBSITE' => $website,
            'PHONE' => $phone,
            'TYPE' => $type,
            'NAME' => $name,
            'COUNTRY' => $country,
            'OAUTH_PROVIDER' => $oauth_provider,
            'TIMESTAMP' => $timestamp,
            'CREATOR' => $creator


        ]);

      /*  $listUidAmazing    = 'xs196nbonac1d';

        $endpoint->create($listUidAmazing, [
            'EMAIL' => $email,
            'FNAME' => $fname,
            'LNAME' => $lname,
            'CATALOGNAME' => $catalogname,
            'CATALOGID' => $catalogid,
            'ID' => $id,
            'NEWSLETTER' => $newsletter,
            'WEBSITE' => $website,
            'PHONE' => $phone,
            'TYPE' => $type,
            'NAME' => $name,
            'COUNTRY' => $country,
            'OAUTH_PROVIDER' => $oauth_provider,
            'TIMESTAMP' => $timestamp,
            'CREATOR' => $creator


        ]);*/




        $response   = $response->body;

        // if the returned status is success, we are done.
        if ($response->itemAt('status') == 'success') {
            exit(json_encode([
                'status'    => 'success',
                'message'   => 'Thank you for joining our email list. Please confirm your email address now!'
            ]));
        }

        // otherwise, the status is error
        exit(json_encode([
            'status'    => 'error',
            'message'   => $response->itemAt('error')
        ]));

















        break;
    case 'transactional':
        //refer to json sendTransactionalEmail($userid,$message,$title)
        echo "Transactional process started.";





        $fname= $_REQUEST["fname"] ;
        $lname= "" ;
        $catalogid= $_REQUEST["catalogid"] ;
        $catalogname= $_REQUEST["catalogname"] ;
        $email= $_REQUEST["email"] ;


        $userid  =$_REQUEST["userid"] ;
        $message  =$_REQUEST["message"] ;
        $title  =$_REQUEST["title"] ;

        include '../mailX/apiMe/email.php';



        // CREATE THE ENDPOINT
        $endpoint = new EmsApi\Endpoint\TransactionalEmails();
 $emailX =str_replace('[CONTENT]',"<br /> $message <br /> <br />","$emailX");
 $emailX =str_replace('[TITLE]',"$title","$emailX");
 $emailX =str_replace('[Recipient]',"$catalogname","$emailX");
        // CREATE A NEW EMAIL
        $response = $endpoint->create([
            'to_name'           => $catalogname, // required
            'to_email'          => $email, // required
            'from_name'         => 'Brand AI', // required
            'from_email'        => 'info@thebrand.ai', // optional
            'reply_to_name'     => 'Brand Support', // optional
            'reply_to_email'    => 'info@thebrand.ai', // optional
            'subject'           => $title, // required
            'body'              => $emailX, // required
            'plain_text'        => '', // optional, will be autogenerated if missing
            'send_at'           => date('Y-m-d H:i:s'),  // required, UTC date time in same format!
            'attachments'       => []
        ]);

// DISPLAY RESPONSE
        /* echo '<hr /><pre>';
           print_r($response->body);
           echo '</pre>';*/




        break;

    case 'registeruser':
        echo "User registration started.";
        // You can put your registration logic here
        break;

    default:
        echo "Invalid or missing mode. Please provide ?mode=onboard or ?mode=registeruser";
        break;
}