<?php
$Curl = curl_init();
$PostFields =
[
'to' => 'receiver_name@gmail.com',
'subject' => 'Company Newsletter - August 2026',
'message' => 'Welcome to our NewsletterThank you for subscribing!',
'from_email' => 'sender_name@company.com',
'from_name' => 'Company Support',
'Bcc' =>
[
'0' => 'bcc_1@company.com',
'1' => 'bcc_2@company.com',
'2' => 'bcc_3@company.com',
],
'Attachments' =>
[
'0' =>
[
'filename' => 'document.pdf',
'data' => 'base64_encoded_string_here',
],
'1' =>
[
'filename' => 'image.png',
'data' => 'base64_encoded_string_here',
],
],
];
curl_setopt_array(
$Curl,
[
CURLOPT_URL => 'https://apicentral.dev/Email/send',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($PostFields),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER =>
[
'Authorization: Bearer YOUR_API_TOKEN_HERE',
'Content-Type: application/x-www-form-urlencoded'
]
]
);
$Response = curl_exec($Curl);
$Data = json_decode($Response, true);
if (curl_errno($Curl))
$Error = curl_error($Curl);
else
{
$status = $Data['status'];
$message = $Data['message'];
$data = $Data['data'] ?? null;
}
curl_close($Curl); // Omit in PHP 8 and above
?>
import requests
import json
url = 'https://apicentral.dev/Email/send'
Headers = {'Authorization': 'Bearer YOUR_API_TOKEN_HERE'}
Data =
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
}
try:
Response = requests.post(url, json=Data, headers=Headers)
ResData = Response.json()
status = ResData.get('status')
message = ResData.get('message')
data = ResData.get('data')
except Exception as e:
error = str(e)
const axios = require('axios');
const Data =
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
};
axios.post(
'https://apicentral.dev/Email/send',
Data,
{
headers: {'Authorization': 'Bearer YOUR_API_TOKEN_HERE'}
}
)
.then(Response =>
{
const status = Response.data.status;
const message = Response.data.message;
const data = Response.data.data;
})
.catch(Error => { const error = Error.message; });
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.time.Duration;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class ApiExample
{
public static void main(String[] args)
{
String url = "https://apicentral.dev/Email/send";
String JsonPayload = """
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
}
""";
HttpClient Client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(30))
.build();
HttpRequest Request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer YOUR_API_TOKEN_HERE")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(JsonPayload))
.build();
try
{
HttpResponse Response = Client.send(Request, HttpResponse.BodyHandlers.ofString());
JsonObject ResData = JsonParser.parseString(Response.body()).getAsJsonObject();
String status = ResData.get("status").getAsString();
String message = ResData.get("message").getAsString();
Object data = ResData.has("data") ? ResData.get("data") : null;
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
using System;
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;
public class ApiExample
{
public static async Task Main()
{
using var Client = new HttpClient();
Client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_TOKEN_HERE");
var json_payload = @"
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
}";
var content = new StringContent(json_payload, Encoding.UTF8, "application/json");
var Response = await Client.PostAsync("https://apicentral.dev/Email/send", content);
var Result = await Response.Content.ReadAsStringAsync();
dynamic ResData = JsonConvert.DeserializeObject(Result);
string status = ResData.status;
string message = ResData.message;
object data = ResData.data;
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"io"
)
func main() {
JsonPayload := []byte(`
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
}`)
Client := &http.Client{}
Request, _ := http.NewRequest("POST", "https://apicentral.dev/Email/send", bytes.NewBuffer(JsonPayload))
Request.Header.Set("Authorization", "Bearer YOUR_API_TOKEN_HERE")
Request.Header.Set("Content-Type", "application/json")
Response, err := Client.Do(Request)
if err != nil {
fmt.Println("Error:", err)
return
}
defer Response.Body.Close()
Body, _ := io.ReadAll(Response.Body)
var ResData map[string]interface{}
json.Unmarshal(Body, &ResData)
status := ResData["status"]
message := ResData["message"]
data := ResData["data"]
fmt.Println(status, message, data)
}
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://apicentral.dev/Email/send')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer YOUR_API_TOKEN_HERE'
request['Content-Type'] = 'application/json'
request.body =
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
}.to_json
response = http.request(request)
res_data = JSON.parse(response.body)
status = res_data['status']
message = res_data['message']
data = res_data['data']
import Foundation
let url = URL(string: "https://apicentral.dev/Email/send")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer YOUR_API_TOKEN_HERE", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let JsonPayload = """
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
}
""".data(using: .utf8)!
request.httpBody = JsonPayload
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("Error: \(error)")
return
}
guard let data = data else { return }
if let resData = try? JSONSerialization.jsonObject(with: data) as? [String: Any] {
let status = resData["status"] as? String
let message = resData["message"] as? String
let data = resData["data"]
}
}
task.resume()
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.time.Duration
import com.google.gson.JsonParser
fun main() {
val url = "https://apicentral.dev/Email/send"
val jsonPayload = """
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
}
""".trimIndent()
val client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(30))
.build()
val request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer YOUR_API_TOKEN_HERE")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build()
try {
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
val resData = JsonParser.parseString(response.body()).asJsonObject
val status = resData.get("status").asString
val message = resData.get("message").asString
val data = if (resData.has("data")) resData.get("data") else null
} catch (e: Exception) {
e.printStackTrace()
}
}
import 'dart:convert';
import 'package:http/http.dart' as http;
void main() async {
final url = Uri.parse('https://apicentral.dev/Email/send');
final headers = {
'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
'Content-Type': 'application/json'
};
final body = jsonEncode(
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
});
try {
final response = await http.post(url, headers: headers, body: body);
final resData = jsonDecode(response.body);
final status = resData['status'];
final message = resData['message'];
final data = resData['data'];
} catch (e) {
print('Error: $e');
}
}
use reqwest::blocking::Client;
use serde_json::Value;
fn main() -> Result<(), Box> {
let client = Client::new();
let json_payload = r#"
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
}
"#;
let response = client
.post("https://apicentral.dev/Email/send")
.header("Authorization", "Bearer YOUR_API_TOKEN_HERE")
.header("Content-Type", "application/json")
.body(json_payload.to_string())
.send()?;
let res_data: Value = serde_json::from_str(&response.text()?)?;
let status = &res_data["status"];
let message = &res_data["message"];
let data = &res_data["data"];
println!("{} {} {:?}", status, message, data);
Ok(())
}
curl -X POST 'https://apicentral.dev/Email/send' \
-H 'Authorization: Bearer YOUR_API_TOKEN_HERE' \
-H 'Content-Type: application/json' \
-d '
{
"to": "receiver_name@gmail.com",
"subject": "Company Newsletter - August 2026",
"message": "Welcome to our NewsletterThank you for subscribing!",
"from_email": "sender_name@company.com",
"from_name": "Company Support",
"Bcc":
{
"0": "bcc_1@company.com",
"1": "bcc_2@company.com",
"2": "bcc_3@company.com"
},
"Attachments":
{
"0":
{
"filename": "document.pdf",
"data": "base64_encoded_string_here"
},
"1":
{
"filename": "image.png",
"data": "base64_encoded_string_here"
}
}
}'