API de E-mail para Desenvolvedores: Otimize a Entregabilidade

A API de E-mail da TurboSMTP revoluciona o seu fluxo de trabalho de desenvolvimento, oferecendo uma integração ultrarrápida e entrega instantânea de e-mails. Descubra a simplicidade de integrar com qualquer aplicação ou website através da nossa documentação API — o envio de e-mails em grande escala nunca foi tão simples.

API de E-mail para Desenvolvedores

API de E-mail para Desenvolvedores, por Desenvolvedores

A API de E-mail da TurboSMTP torna a integração dos serviços de e-mail na sua aplicação extremamente simples. Com uma API intuitiva, integração fluida e uma documentação completa, pode escalar rapidamente o envio de e-mails, sejam 2 mensagens ou 2 milhões.
Abaixo encontrará exemplos práticos para integrar as nossas APIs com as linguagens de programação mais utilizadas.

curl -X "POST"^
  "https://api.turbo-smtp.com/api/v2/mail/send" ^
  -H "accept: application/json" ^
  -H "consumerKey: <CONSUMER_KEY>" ^
  -H "consumerSecret: <CONSUMER_SECRET>" ^
  -H "Content-Type: application/json" ^
  -d ^
"{^
  ""from"": ""hello@your-company.com"",^
  ""to"": ""Doe.Jhon@gmail.com,contact@global-travel.com"",^
  ""subject"": ""New live training session"",^
  ""cc"": ""cc_user@example.com"",^
  ""bcc"": ""bcc_user@example.com"",^
  ""content"": ""Dear partner, we are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills."",^
  ""html_content"": ""Dear partner, we are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills.""^
}"
curl -X 'POST' \
  'https://api.turbo-smtp.com/api/v2/mail/send' \
  -H 'accept: application/json' \
  -H 'consumerKey:  <CONSUMER_KEY>' \
  -H 'consumerSecret: <CONSUMER_SECRET>' \
  -H 'Content-Type: application/json' \
  -d '{
  "from": "hello@your-company.com",
  "to": "Doe.Jhon@gmail.com,contact@global-travel.com",
  "subject": "New live training session",
  "cc": "cc_user@example.com",
  "bcc": "bcc_user@example.com",
  "content": "Dear partner,\nWe are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills.",
  "html_content": "Dear partner,\nWe are delighted to invite you to an exclusive training session on <strong>UX Design</strong>. This session is designed to provide essential insights and practical strategies to enhance your skills."
}'
curl.exe -X 'POST' `
  'https://api.turbo-smtp.com/api/v2/mail/send' `
  -H 'accept: application/json'  `
  -H 'consumerKey:  <CONSUMER_KEY>'  `
  -H 'consumerSecret: <CONSUMER_SECRET>'  `
  -H 'Content-Type: application/json' `
  -d @"
{
  \"from\": \"hello@your-company.com\",
  \"to\": \"Doe.Jhon@gmail.com,contact@global-travel.com\",
  \"subject\": \"New live training session\",
  \"cc\": \"cc_user@example.com\",
  \"bcc\": \"bcc_user@example.com\",
  \"content\": \"Dear partner,\nWe are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills.\",
  \"html_content\": \"Dear partner,\nWe are delighted to invite you to an exclusive training session on <strong>UX Design</strong>. This session is designed to provide essential insights and practical strategies to enhance your skills.\"
}
"@
using System.Text;
using System.Text.Json;

public class Program
{
    public static async Task Main(string[] args)
    {
        var consumerKey = "<CONSUMER_KEY>";
        var consumerSecret = "<CONSUMER_SECRET>";

        string url = "https://api.turbo-smtp.com/api/v2/mail/send";
        
        var mailData = new { 
            from = "hello@your-company.com", 
            to = "Doe.Jhon@gmail.com,contact@global-travel.com",
            subject = "New live training session",
            cc = "cc_user@example.com",
            bcc = "bcc_user@example.com",
            content = "Dear partner, we are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills.",
            html_content = "Dear partner, We are delighted to invite you to an exclusive training session on <strong>UX Design</strong>. This session is designed to provide essential insights and practical strategies to enhance your skills."
        }; // Mail Data setup.

        using (HttpClient httpClient = new HttpClient())
        {
            // JSON data seriaization
            var json = JsonSerializer.Serialize(mailData);
            var content = new StringContent(json, Encoding.UTF8, "application/json");

            // Set authentication headers
            content.Headers.Add("consumerKey", consumerKey);
            content.Headers.Add("consumerSecret", consumerSecret);

            // Trigger POST request
            using (var response = await httpClient.PostAsync(url, content))
            {
                if (response.IsSuccessStatusCode)
                {
                    var result = await response.Content.ReadAsStringAsync();
                    Console.WriteLine("Response: " + result);
                }
                else
                {
                    Console.WriteLine("Request error: " + response.StatusCode);
                }
            }
        }
    }
}
package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	// setup.
	url := "https://api.turbo-smtp.com/api/v2/mail/send"
	consumerkey := "<CONSUMER_KEY>"
	consumerSecret := "<CONSUMER_SECRET>"	

	// Body Data.
	data := []byte(`{
		"from": "hello@your-company.com",
		"to": "Doe.Jhon@gmail.com,contact@global-travel.com",
		"subject": "New live training session",
		"cc": "cc_user@example.com",
		"bcc": "bcc_user@example.com",
		"content": "Dear partner,\nWe are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills.",
		"html_content": "Dear partner,\nWe are delighted to invite you to an exclusive training session on <strong>UX Design</strong>. This session is designed to provide essential insights and practical strategies to enhance your skills."
		}`)

	// Create POST Resquest.
	req, err := http.NewRequest("POST", url, bytes.NewBuffer(data))
	if err != nil {
		fmt.Println("An Error has occured:", err)
		return
	}

	// Set Request Headers.
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("accept", "application/json")
	req.Header.Set("consumerKey", consumerkey)
	req.Header.Set("consumerSecret", consumerSecret)		

	// Perform HTTP Request.
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("An Error has occured sending the request:", err)
		return
	}
	defer resp.Body.Close()

	// Read Server Response
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("An Error has occured reading the server response:", err)
		return
	}

	// Print Server Response
	fmt.Println(string(body))
}
const https = require('https');

//setup credentials.
const consumerKey = '<CONSUMER_KEY>';
const consumerSecret = '<CONSUMER_SECRET>';

//setup body.
const sendData = {
    from: 'hello@your-company.com',
    to: 'Doe.Jhon@gmail.com,contact@global-travel.com',
    subject: 'New live training session',
    cc: 'cc_user@example.com',
    bcc: 'bcc_user@example.com',
    content: 'Dear partner,\nWe are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills.',
    html_content: 'Dear partner, <br>We are delighted to invite you to an exclusive training session on <strong>UX Design</strong>. This session is designed to provide essential insights and practical strategies to enhance your skills.',
};


//setup request options.
const options = {
    hostname: 'api.turbo-smtp.com',
    path: '/api/v2/mail/send',
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Consumerkey': consumerKey,
        'Consumersecret': consumerSecret,
        'Content-Type': 'application/json',
    },
};

//perform http request
const req = https.request(options, (res) => {
    let responseData = '';

    res.on('data', (chunk) => {
        responseData += chunk;
    });

    res.on('end', () => {
        console.log('Response:', responseData);
    });
});

//handle request error.
req.on('error', (error) => {
    console.error('Error:', error.message);
});

//write response.
req.write(JSON.stringify(sendData));
req.end();
import http.client
import json

# setup credentials.
consumerKey = '<CONSUMER_KEY>'
consumerSecret = '<CONSUMER_SECRET>'

# setup body.
data = {
    'from': 'hello@your-company.com',
    'to': 'Doe.Jhon@gmail.com,contact@global-travel.com',
    'subject': 'New live training session',
    'cc': 'cc_user@example.com',
    'bcc': 'bcc_user@example.com',
    'content': 'Dear partner,\nWe are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills.',
    'html_content': 'Dear partner, <br>We are delighted to invite you to an exclusive training session on <strong>UX Design</strong>. This session is designed to provide essential insights and practical strategies to enhance your skills.'
}

# convert body to json.
data_json = json.dumps(data)

# setup headers
headers = {
        'Accept': 'application/json',
        'Consumerkey': consumerKey,
        'Consumersecret': consumerSecret,
        'Content-Type': 'application/json',
}

# Setup URL and endpoint
url = 'api.turbo-smtp.com'
endpoint = '/api/v2/mail/send'

# Create HTTP connection.
conn = http.client.HTTPConnection(url)

# Perform POST request.
try:
    conn.request('POST', endpoint, body=data_json, headers=headers)
    response = conn.getresponse()

    # Read Server response.
    response_data = response.read().decode('utf-8')
    print(response_data)

    # Close connection.
    conn.close()
except http.client.HTTPException as e:
    # Handle HTTP errors
    print('Error on HTTP request:', e)
except ConnectionError as e:
    # Handle Connection errors
    print('Error on HTTP connection:', e)
require 'net/https'
require 'uri'

# URL of the endpoint you want to send the POST request to
url = URI.parse('https://api.turbo-smtp.com/api/v2/mail/send')
consumerKey = "<CONSUMER_KEY>";
consumerSecret = "<CONSUMER_SECRET>";

# Data to send in the request body
data = {
    'from' => 'hello@your-company.com',
    'to' => 'Doe.Jhon@gmail.com,contact@global-travel.com',
    'subject' => 'New live training session',
    'cc' => 'cc_user@example.com',
    'bcc' => 'bcc_user@example.com',
    'content' => 'Dear partner,\nWe are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills.',
    'html_content' => 'Dear partner, <br>We are delighted to invite you to an exclusive training session on <strong>UX Design</strong>. This session is designed to provide essential insights and practical strategies to enhance your skills.'
}

# Create the HTTPS connection
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

# Create the request object
request = Net::HTTP::Post.new(url.path)
request["Consumerkey"] = consumerKey 
request["Consumersecret"] = consumerSecret 
request["Content-Type"] = "application/json" 
request["Accept"] = "application/json" 

request.set_form_data(data)

# Send the request and get the response
response = http.request(request)

# Print the response body
puts response.body
<?php

$send_data = [
    "from" => "hello@your-company.com",
    "to" => "Doe.Jhon@gmail.com,contact@global-travel.com",
    "subject" => "New live training session",
    "cc" => "cc_user@example.com",
    "bcc" => "bcc_user@example.com",
    "content" => "Dear partner,\n We are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills.",
    "html_content" => "Dear partner,<br />We are delighted to invite you to an exclusive training session on <strong>UX Design</strong>. This session is designed to provide essential insights and practical strategies to enhance your skills."
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.turbo-smtp.com/api/v2/mail/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($send_data));

$headers = array();
$headers[] = 'Accept: application/json';
$headers[] = 'Consumerkey: <CONSUMER_KEY>';
$headers[] = 'Consumersecret: <CONSUMER_SECRET>';
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else if ($http_code !== 200) {
    echo "Request error: ".$http_code;
} else {
    echo "Response: ".$result;
}
curl_close($ch);
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class TurboSMTPMailExample {
    public static void main(String[] args) {
        try {
            // Specify the URL of the API endpoint
            URL url = new URL("https://api.turbo-smtp.com/api/v2/mail/send");

            // Specify Credentials
            String Consumerkey = "<CONSUMER_KEY>";
            String Consumersecret = "<CONSUMER_SECRET>";

            // Open a connection to the URL
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();

            // Set the request method to POST
            connection.setRequestMethod("GET");

            // Set the request headers
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Accept", "application/json");
            connection.setRequestProperty("Consumerkey", Consumerkey);
            connection.setRequestProperty("Consumersecret", Consumersecret);

            // Enable input and output streams
            connection.setDoInput(true);
            connection.setDoOutput(true);

            // Define the request body (as JSON)
            //String requestBody = "{\"from\": \"user@example.com\", \"to\": \"user@example.com,user2@example.com\", \"subject\": \"This is a test message\"}";
            
            String requestBody = "{" +
                                "\"from\": \"user@example.com\", " +
                                "\"to\": \"user@example.com,user2@example.com\", " +
                                "\"subject\": \"This is a test message\", " +
                                "\"cc\": \"cc_user@example.com\", " +
                                "\"bcc\": \"bcc_user@example.com\", " +
                                "\"content\": \"Dear partner. We are delighted to invite you to an exclusive training session on UX Design. This session is designed to provide essential insights and practical strategies to enhance your skills.\", " +
                                "\"html_content\": \"Dear partner,<br />We are delighted to invite you to an exclusive training session on <strong>UX Design</strong>. This session is designed to provide essential insights and practical strategies to enhance your skills.\" " +
                                "}";            
            
            DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
            outputStream.writeBytes(requestBody);
            outputStream.flush();
            outputStream.close();

            // Get the response code
            int responseCode = connection.getResponseCode();

            // Read the response from the server
            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String line;
            StringBuilder response = new StringBuilder();
            while ((line = reader.readLine()) != null) {
                response.append(line);
            }
            reader.close();

            // Print the response
            System.out.println("Response Code: " + responseCode);
            System.out.println("Response Body: " + response.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Envie E-mails com a sua Linguagem de Programação Favorita

As nossas APIs oferecem aos desenvolvedores a flexibilidade de integrar facilmente soluções de e-mail com os seus linguagens de programação preferidas. Seja em Python, cURL, Ruby ou qualquer outra linguagem popular, o nosso suporte completo de API tem tudo o que precisa.

Destaques do Serviço TurboSMTP

Aqui estão quatro razões convincentes para escolher o serviço TurboSMTP: entrega de e-mails sem igual, análise de dados para decisões informadas, privacidade e segurança robustas, e suporte dedicado 24/7 para uma experiência de e-mail sem preocupações.

Infraestrutura Potente para Alta Entregabilidade

A nossa infraestrutura escala de forma fluida desde alguns até vários milhões de e-mails, simplificando a distribuição massiva com soluções cloud que suportam integração SMTP e RESTful API.
Além disso, a TurboSMTP garante uma entrega rápida de e-mails, fundamental para manter as comunicações atempadas e fortalecer os laços com o seu público.

Infraestrutura Potente para Alta Entregabilidade
Otimize as Campanhas com Métricas e Analytics

Otimize as Campanhas com Métricas e Analytics

As ferramentas de estatísticas e relatórios da TurboSMTP transformam a sua estratégia de e-mail com dados imediatamente aproveitáveis. O nosso painel de analytics fornece métricas em tempo real sobre entregabilidade, aberturas, cliques e bounces, permitindo-lhe otimizar as campanhas de forma eficaz. Monitorize o comportamento dos destinatários para aperfeiçoar as suas mensagens, melhorar o engagement e aumentar as conversões. Com a TurboSMTP, tome decisões baseadas em dados para campanhas segmentadas que gerem um melhor ROI e aprofundem os laços com o seu público.

Privacidade e Segurança de E-mail: Valores Fundamentais

O nosso serviço de e-mail foi desenvolvido tendo em conta a sua privacidade e segurança, integrando protocolos de encriptação avançados para proteger os seus dados.
O rigoroso cumprimento das leis de privacidade é a base do nosso serviço, garantindo que cada e-mail está protegido contra acessos não autorizados e que as suas comunicações privadas permanecem sempre seguras.

Privacidade e Segurança de E-mail: Valores Fundamentais
Suporte Sempre Disponível, Quando Precisar

Suporte Sempre Disponível, Quando Precisar

Na TurboSMTP, oferecemos um suporte 24/7 que vai além do simples serviço: é um compromisso partilhado. A nossa equipa dedicada está sempre ao seu lado, pronta a fornecer orientação especializada e resoluções rápidas. Com um compromisso constante com a excelência, garantimos que a sua experiência de e-mail seja fluida e sem preocupações. Conte connosco para um suporte fiável em cada etapa do processo de envio de e-mails.

Comece com a API de E-mail da TurboSMTP

Siga estes três passos simples para integrar a TurboSMTP na sua aplicação.

Registe-se gratuitamente e obtenha 6.000 e-mails gratuitos por mês.

Recupere a sua chave API a partir do seu painel de controlo.

Consulte a nossa documentação API para iniciar a sua integração.