import requests
import json
url = "https://emailapi.netcorecloud.net/v5/mail/send"
payload = {
"from": {
"email": "confirmation@pepisandbox.com",
"name": "Flight confirmation"
},
"subject": "Your Barcelona flight e-ticket : BCN2118050657714",
"content": [
{
"type": "html",
"value": "Hello Lionel, Your flight for Barcelona is confirmed."
}
],
"personalizations": [
{
"to": [
{
"email": "lionel@gmail.com",
"name": "Lionel Messi"
}
]
}
]
}
headers = {
"api_key": "",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.text)
curl --request POST \
--url https://emailapi.netcorecloud.net/v5/mail/send \
--header 'api_key: ' \
--header 'Content-Type: application/json' \
--data '{
"from": {
"email": "confirmation@pepisandbox.com",
"name": "Flight confirmation"
},
"subject": "Your Barcelona flight e-ticket : BCN2118050657714",
"content": [
{
"type": "html",
"value": "Hello Lionel, Your flight for Barcelona is confirmed."
}
],
"personalizations": [
{
"to": [
{
"email": "lionel@gmail.com",
"name": "Lionel Messi"
}
]
}
]
}'
const https = require('https');
const data = JSON.stringify({
from: {
email: 'confirmation@pepisandbox.com',
name: 'Flight confirmation'
},
subject: 'Your Barcelona flight e-ticket : BCN2118050657714',
content: [
{
type: 'html',
value: 'Hello Lionel, Your flight for Barcelona is confirmed.'
}
],
personalizations: [
{
to: [
{
email: 'lionel@gmail.com',
name: 'Lionel Messi'
}
]
}
]
});
const options = {
hostname: 'emailapi.netcorecloud.net',
path: '/v5/mail/send',
method: 'POST',
headers: {
'api_key': '',
'Content-Type': 'application/json',
'Content-Length': data.length
}
};
const req = https.request(options, (res) => {
let body = '';
res.on('data', (chunk) => {
body += chunk;
});
res.on('end', () => {
console.log('Response:', body);
});
});
req.on('error', (e) => {
console.error('Request error:', e);
});
req.write(data);
req.end();
require 'uri'
require 'net/http'
require 'openssl'
require 'json'
url = URI("https://emailapi.netcorecloud.net/v5/mail/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = ""
request["Content-Type"] = "application/json"
payload = {
from: {
email: "confirmation@pepisandbox.com",
name: "Flight confirmation"
},
subject: "Your Barcelona flight e-ticket : BCN2118050657714",
content: [
{
type: "html",
value: "Hello Lionel, Your flight for Barcelona is confirmed."
}
],
personalizations: [
{
to: [
{
email: "lionel@gmail.com",
name: "Lionel Messi"
}
]
}
]
}
request.body = payload.to_json
response = http.request(request)
puts response.body
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://emailapi.netcorecloud.net/v5/mail/send"
payload := map[string]interface{}{
"from": map[string]string{
"email": "confirmation@pepisandbox.com",
"name": "Flight confirmation",
},
"subject": "Your Barcelona flight e-ticket : BCN2118050657714",
"content": []map[string]string{
{
"type": "html",
"value": "Hello Lionel, Your flight for Barcelona is confirmed.",
},
},
"personalizations": []map[string][]map[string]string{
{
"to": {
{
"email": "lionel@gmail.com",
"name": "Lionel Messi",
},
},
},
},
}
jsonData, err := json.Marshal(payload)
if err != nil {
fmt.Println("Error marshaling JSON:", err)
return
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("api_key", "")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
res, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println("Status:", res.Status)
fmt.Println("Response:", string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://emailapi.netcorecloud.net/v5/mail/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"from\":{\"email\":\"confirmation@pepisandbox.com\",\"name\":\"Flight confirmation\"},\"subject\":\"Your Barcelona flight e-ticket : BCN2118050657714\",\"content\":[{\"type\":\"html\",\"value\":\"Hello Lionel, Your flight for Barcelona is confirmed.\"}],\"personalizations\":[{\"to\":[{\"email\":\"lionel@gmail.com\",\"name\":\"Lionel Messi\"}]}]}",
CURLOPT_HTTPHEADER => array(
"api_key: <Your API Key>",
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse<String> response = Unirest.post("https://emailapi.netcorecloud.net/v5/mail/send")
.header("api_key", "<Your API Key>")
.header("content-type", "application/json")
.body("{\"from\":{\"email\":\"confirmation@pepisandbox.com\",\"name\":\"Flight confirmation\"},\"subject\":\"Your Barcelona flight e-ticket : BCN2118050657714\",\"content\":[{\"type\":\"html\",\"value\":\"Hello Lionel, Your flight for Barcelona is confirmed.\"}],\"personalizations\":[{\"to\":[{\"email\":\"lionel@gmail.com\",\"name\":\"Lionel Messi\"}]}]}")
.asString();
using RestSharp;
var client = new RestClient("https://emailapi.netcorecloud.net/v5/mail/send");
var request = new RestRequest(Method.POST);
request.AddHeader("api_key", "");
request.AddHeader("Content-Type", "application/json");
var payload = new
{
from = new
{
email = "confirmation@pepisandbox.com",
name = "Flight confirmation"
},
subject = "Your Barcelona flight e-ticket : BCN2118050657714",
content = new[]
{
new
{
type = "html",
value = "Hello Lionel, Your flight for Barcelona is confirmed."
}
},
personalizations = new[]
{
new
{
to = new[]
{
new
{
email = "lionel@gmail.com",
name = "Lionel Messi"
}
}
}
}
};
request.AddJsonBody(payload);
IRestResponse response = client.Execute(request);
// Output the response
Console.WriteLine("Status Code: " + response.StatusCode);
Console.WriteLine("Response: " + response.Content);
wget --quiet \
--header="api_key: " \
--header="Content-Type: application/json" \
--post-data='{
"from": {
"email": "confirmation@pepisandbox.com",
"name": "Flight confirmation"
},
"subject": "Your Barcelona flight e-ticket : BCN2118050657714",
"content": [
{
"type": "html",
"value": "Hello Lionel, Your flight for Barcelona is confirmed."
}
],
"personalizations": [
{
"to": [
{
"email": "lionel@gmail.com",
"name": "Lionel Messi"
}
]
}
]
}' \
--output-document=- \
https://emailapi.netcorecloud.net/v5/mail/send
var data = JSON.stringify({
"from": {
"email": "confirmation@pepisandbox.com",
"name": "Flight confirmation"
},
"subject": "Your Barcelona flight e-ticket : BCN2118050657714",
"content": [
{
"type": "html",
"value": "Hello Lionel, Your flight for Barcelona is confirmed."
}
],
"personalizations": [
{
"to": [
{
"email": "lionel@gmail.com",
"name": "Lionel Messi"
}
]
}
]
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://emailapi.netcorecloud.net/v5/mail/send");
xhr.setRequestHeader("api_key", "");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);