Our SMTP API is a great way to tailor turboSMTP’s outgoing mail server as you prefer, intergrating it elswhere.

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

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

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

Download the sample source code

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]

Parameters Mandatory Bonds Descriptions
to Yes Valid email addresses. Recipients list. In case of multiple recipients, the addresses must be separated by a comma.
subject No Max 700 characters string. The subject of the email to be sent.
from Yes Valid email address. The sender address of the email to be sent.
bcc No Valid email addresses. Blind carbon copy list. In case of multiple recipients, the addresses must be separated by a comma.
cc No Valid email address Carbon copy list. In case of multiple recipients, the addresses must be separated by a comma.
content No Email’s textual content.
html_content No Email’s HTML content.
custom_headers No Valid JSON format. Key collection value of custom headers to put in the email. Example:

 {"X-key1":"value1", "X-key2":"value2"}
mime_raw No MIME 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"]}

NOTE: this error is referred to a malformed email. We don’t do any hard/soft bounce check at this stage, since the API only puts your email in our queues. If you want to know if a contact bounced you need to check it in the dashboard reports.

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 API.

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 API.

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