PHP Email Service Payload Formatting

I have a PHP server side script and I need to send an email but cannot find an example on how to format the payload. This is what I have but am getting a rest exception saying the email address is invalid. How should i format the payload for my email service?

        $email_content = [
      'template' => 'retired__form',
      'to'=> [
          'name' => $org_admin_name,
          'email' => $org_admin_email
      ],
      'subject'         => 'Retired Form Failure',
      'body_text'       => 'Hi {name}, This is a notification for a retired form submission.',
      'from_name'       => 'XXX Notifications',
      'from_email'      => 'notifications@abc.com',
      'reply_to_name'   => 'XXX Support',
      'reply_to_email'  => 'support@abc.com',
      'org_admin_name'  => $org_admin_name,
      'auditor'         => $this_auditor,
      'form_name'       => $form_name_pretty,
      'submission_date' => $nicedate,
      'institution'     => $this_institution
    ];

And as a followup if I json_encode this and test it with the API docs, the email goes through fine. For whatever reason using the post api doesn’t like this payload and reports an Invalid Email address. Any ideas would be helpful.

I resolved this. The array needs to sent as is and not as a resource to the service. FYI.

Thanks for updating your thread with your solution @Mike_Harvey!