turboSMTP's API is a great way to tailor our service as you prefer, intergrating it elswhere.

Broadly speaking, an API (Application Programming Interface) is a protocol defining an interface for software components, so that they can communicate with each other.

At the moment we provide a Send method that allows you to create a script to run turboSMTP and send transactional emails (login confirmation, welcome messages, receipts etc.) via web, without using the SMTP protocol.

So if you have a website or an app and you need to send a message directly from there, you can implement this method in your script and manage it easily.

Below you will find the full documentation. We are currently developing new methods, so stay tuned for more!

Download source code sample

PHP C# Java Python Perl Ruby

Send (Beta 1.0)

The service allows you to send an email


  • Parameters
  • POST request
  • MIME body message
  • Example of email sending (curl)
  • Example of email sending (PHP)
  • TurboApiClient (PHP)
  • Download source code example (PHP)


Parameters [top]

toYesValid email addresses.Recipients list. In case of multiple recipients, the addresses must be separated by a comma.
subjectNoMax 700 characters string.The subject of the email to be sent.
fromYesValid email address.The sender address of the email to be sent.
bccNoValid email addresses.Blind carbon copy list. In case of multiple recipients, the addresses must be separated by a comma.
ccNoValid email addressCarbon copy list. In case of multiple recipients, the addresses must be separated by a comma.
contentNo Email's textual content.
html_contentNo Email's HTML content.
custom_headersNoValid JSON format.Key collection value of custom headers to put in the email. Example:
 {"X-key1":"value1", "X-key2":"value2"}
mime_rawNoMIME standard format.MIME type message, replacing content and html_content.


Post request [top]


The user authentication takes place through the following parameters:

  • authuser: Username
  • authpass: Password

The authentication data can be handled as GET and POST parameters, or as the https request's headers.

Example of Post request,,,
subject:subject of email
content:text content of email
html_content: html content of email
custom_headers:{"X-key1":"value1", "X-key2":"value2"}

Post response

The server's responses are in JSON format. The object's members are:

  • message: outcome of the response "OK" in case of success, "error" in case of error
  • errors: (only in case of error) array containing the error messages


Success response

 { "message":"OK" }

Error response

 { "message": "error","errors": ["error message",...]} 

Example of an error response

 { "message": "error","errors": ["'broken@@@Address.@@' recipient email not valid" , "'broken2@@@Address2.@@222' bcc email not valid"]} 


MIME type body message [top]

In case you want to send as the email's body a MIME type message, you must send it as a POST parameter named "mime".

In this case the content and content_html parameters are ignored. The message must be standard. If you send a message without header you need in any case, as required by specification, to let an empty line before the body.

This parameter allows to send a file inside the message.


Example of a (curl) email sending [top]

Sample code to send an email using the curl command.

Email dispatch

Let's send an email using the authentication key obtained from the previous call.

curl --Header "authuser:_username" --Header "authpass:_password" --data " subject string& email&html_content=html content of email"


Example of (PHP) email sending [top]

Sample PHP code to send an email using our APIs.

Source code
require_once "TurboApiClient.php";

// creation of the email to be sent
$email = new Email();
$email->setHtmlContent("html content");
$email->addCustomHeader('X-FirstHeader', "value");
$email->addCustomHeader('X-SecondHeader', "value");
$email->addCustomHeader('X-Header-to-be-removed', 'value');

// creation of a client that connects with turbo-smtp APIs
$turboApiClient = new TurboApiClient("_username", "_password");

// email sending
$response = $turboApiClient->sendEmail($email);

// display of the operation's outcome


TurboApiClient (PHP) [top]

A simple client useful to connect with our APIs.

source code
require_once  "TurboClient.php";
require_once  "Email.php";

class TurboApiClient{
	protected $username;
	protected $password;
	private $serverUrl = "";

	public function __construct($username, $password) {
       $this->username = $username;
	   $this->password = $password;

	protected function authorize(){
		try {
			$api = new TurboClient($this->serverUrl, $this->username, $this->password);
			return $api;
		} catch (Pest_Forbidden $ex) {
		    return null;

	public function sendEmail($email){
		$api = $this->authorize();
			try {
			    	$response = $api->post(
			    return $response;
			} catch (Pest_NotFound $e) {
			    return $e;
			return "Authorization error";


Download the sample source code [top]

PHP C# Java Python Perl Ruby