📧 Email SMTP API

Email Sending SMTP API Reference

Send emails programmatically via the iSMS platform — transactional emails, OTP codes, invoices, notifications, and bulk campaigns. Supports HTML body and file attachments.

Endpoint: smtpapi.vocotext.com Method: POST (multipart/form-data) Attachments: Supported

What You Can Send

🔑

OTP & Verification

Send one-time passwords and email verification codes securely.

🧾

Invoices & Receipts

Transactional emails triggered automatically by your billing system.

📢

Marketing Campaigns

Bulk promotional emails to opted-in customer lists.

🔔

System Alerts

Automated alerts for system events, error logs, or threshold triggers.

📰

Newsletters

Regular subscriber newsletters with HTML content and images.

📎

With Attachments

Send PDFs, reports, and documents as email attachments.

📡 API Endpoint

Endpointhttps://smtpapi.vocotext.com/isms_send_email_smtp_api.php
POST multipart/form-data
ℹ️Use multipart/form-data encoding for all requests, especially when sending attachments. Standard application/x-www-form-urlencoded is sufficient for text-only emails.

🔧 Domain Setup Requirements

Before sending emails via the API, your sending domain must be verified and properly configured. This ensures high deliverability and prevents your emails from being marked as spam.

1

Prepare Your Domain

Ensure you have a dedicated domain for sending emails — e.g. yourcompany.com or mail.yourcompany.com. A dedicated domain improves sender reputation.

2

Verify Domain Ownership

Add a verification TXT record to your domain's DNS settings. Contact iSMS support for your specific verification token.

3

Configure DNS Records

Set up SPF, DKIM, DMARC, MX, and CNAME records as provided by iSMS to authenticate your sending domain.

4

Create Sender Email

Configure the verified sender email address and display name (fromAlias) in your iSMS account. Use this as the accountName parameter.

⚠️The accountName parameter must be a verified email address registered in your iSMS account. Unverified addresses will be rejected. Contact [email protected] to set up your sending domain.

📋 Request Parameters

All parameters are submitted as multipart/form-data POST fields. The attachment field is optional.

ParameterTypeRequiredDescription
unStringRequiredYour iSMS account username
pwdStringRequiredYour iSMS account password
toEmailStringRequiredRecipient's email address — e.g. [email protected]
subjectStringRequiredEmail subject line
bodyStringRequiredEmail body content — supports plain text or HTML
accountNameStringRequiredVerified sender email address (registered in your iSMS account) — e.g. [email protected]
fromAliasStringRequiredDisplay name shown to the recipient — e.g. My Company Notifications
agreedtermStringRequiredMust be set to YES to confirm acceptance of iSMS Terms & Conditions
attachmentFileOptionalFile attachment — submitted as a multipart file upload. Supports PDF, images, documents, etc.

🐘 PHP Example — Text/HTML Email

Basic email sending without attachment. Use http_build_query() for simple form-encoded POST when no file attachment is needed.

PHPsend_email.php
<?php
$url = 'https://smtpapi.vocotext.com/isms_send_email_smtp_api.php';

$postData = [
    'un'          => 'your_username',
    'pwd'         => 'your_password',
    'toEmail'     => '[email protected]',
    'subject'     => 'Your Invoice #INV-2024-001',
    'body'        => '<h2>Thank you for your order</h2>
                     <p>Your invoice is ready. Please find the details below.</p>',
    'accountName' => '[email protected]',  // Must be verified
    'fromAlias'   => 'My Company Billing',
    'agreedterm'  => 'YES'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'cURL error: ' . curl_error($ch);
} else {
    echo 'Response: ' . $response;
}

curl_close($ch);
?>

📎 PHP Example — With File Attachment

When sending a file attachment, use CURLFile to properly encode the file in a multipart request. Do not use http_build_query() — pass the array directly to CURLOPT_POSTFIELDS.

Attachment Notes

  • ✦ Use CURLFile (PHP 5.5+) for file uploads — avoid deprecated @filepath syntax
  • ✦ Do not use http_build_query() when sending attachments — it does not handle file uploads
  • mime_content_type() auto-detects the MIME type of the file
  • ✦ Maximum attachment size depends on your server's PHP post_max_size and upload_max_filesize settings
PHPsend_email_with_attachment.php
<?php
$url = 'https://smtpapi.vocotext.com/isms_send_email_smtp_api.php';

// File attachment — can be a path from $_FILES or a server-side path
$attachmentPath = '/path/to/invoice.pdf';
$attachmentName = 'invoice_2024.pdf';

$postData = [
    'un'          => 'your_username',
    'pwd'         => 'your_password',
    'toEmail'     => '[email protected]',
    'subject'     => 'Your Invoice is Attached',
    'body'        => '<p>Please find your invoice attached.</p>
                     <p>Thank you for your business!</p>',
    'accountName' => '[email protected]',
    'fromAlias'   => 'My Company Billing',
    'agreedterm'  => 'YES'
];

// Attach file using CURLFile (PHP 5.5+)
if (file_exists($attachmentPath)) {
    $postData['attachment'] = new CURLFile(
        $attachmentPath,
        mime_content_type($attachmentPath),  // Auto-detect MIME
        $attachmentName
    );
}

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Pass array directly — NOT http_build_query() — so CURLFile works
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'cURL error: ' . curl_error($ch);
} else {
    echo 'Response from API: ' . $response;
}

curl_close($ch);
?>

Handling File Upload from Web Form

PHPsend_email_form_upload.php
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {

    // Get file details from uploaded form $_FILES
    $attachmentPath = $_FILES['attachment']['tmp_name'] ?? null;
    $attachmentName = $_FILES['attachment']['name'] ?? null;

    $url = 'https://smtpapi.vocotext.com/isms_send_email_smtp_api.php';

    $postData = [
        'un'          => $_POST['un'],
        'pwd'         => $_POST['pwd'],
        'toEmail'     => $_POST['toEmail'],
        'subject'     => $_POST['subject'],
        'body'        => $_POST['body'],
        'accountName' => $_POST['accountName'],
        'fromAlias'   => $_POST['fromAlias'],
        'agreedterm'  => 'YES'
    ];

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    if ($attachmentPath && $attachmentName) {
        $postData['attachment'] = new CURLFile(
            $attachmentPath,
            mime_content_type($attachmentPath),
            $attachmentName
        );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);  // Array — NOT encoded
    } else {
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
    }

    $response = curl_exec($ch);
    curl_close($ch);

    echo 'Response: ' . $response;
}
?>

🔷 C# Example — Windows Forms / .NET

Full C# implementation using HttpClient and MultipartFormDataContent. Compatible with .NET Framework and .NET Core.

C#EmailSender.cs
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

public class EmailSender
{
    private static readonly string apiUrl =
        "https://smtpapi.vocotext.com/isms_send_email_smtp_api.php";

    public static async Task<string> SendEmailAsync(
        string username, string password,
        string toEmail, string subject, string body,
        string accountName, string fromAlias,
        string attachmentPath = null)
    {
        using var client   = new HttpClient();
        using var formData = new MultipartFormDataContent();

        // Required fields
        formData.Add(new StringContent(username),    "un");
        formData.Add(new StringContent(password),    "pwd");
        formData.Add(new StringContent(toEmail),     "toEmail");
        formData.Add(new StringContent(subject),     "subject");
        formData.Add(new StringContent(body),        "body");
        formData.Add(new StringContent(accountName), "accountName");
        formData.Add(new StringContent(fromAlias),   "fromAlias");
        formData.Add(new StringContent("YES"),       "agreedterm");

        // Optional attachment
        if (!string.IsNullOrEmpty(attachmentPath) &&
            File.Exists(attachmentPath))
        {
            var fileContent = new ByteArrayContent(
                File.ReadAllBytes(attachmentPath));
            fileContent.Headers.ContentType =
                MediaTypeHeaderValue.Parse("multipart/form-data");
            formData.Add(fileContent, "attachment",
                Path.GetFileName(attachmentPath));
        }

        var response = await client.PostAsync(apiUrl, formData);
        return await response.Content.ReadAsStringAsync();
    }
}

// Usage:
// var result = await EmailSender.SendEmailAsync(
//     "your_username", "your_password",
//     "[email protected]", "Your Invoice",
//     "<p>Please find attached.</p>",
//     "[email protected]", "My Company",
//     @"C:\invoices\inv001.pdf"  // optional
// );

Need Email API Access or Domain Setup Help?

Our team will help you verify your sending domain, configure DNS records, and test your first email delivery.

📧 [email protected]  ·  📞 +603-2780 3880

📱 SMS Coverage — All Countries Worldwide

A B C D E F G H I J K L M N O P Q R S T U V Y Z