translate Englishattach_moneyUSDQuick AI Login
emoji_food_beverage Exploreinterests Pigment Libraryattach_email Mail Enginesms Celular Textlocal_library API Docs

Mailpress SMTP Mail Engine API Documentation

You have a killer email marketing campaign locked and loaded. Now, how to send it to the 2000 or 2 million email addresses on your contact list? For most marketers, an email service provider (ESP) is the answer to reliably and effectively delivering mass email without the hassle or costs of trying to do it yourself. ESPs often provide email marketing software that helps you manage and deliver your messages. However, using an email service doesn't mean you'll break the bank sending content to your subscribers. We offer comprehensive deliverability features and powerful marketing automation tools without breaking local laws.

Below are the endpoints for accessing On-Demand Mail Engine. Learn how to integrate the API into your application.

Authorization:

  • privateId *Specify privateId for site
    (e.g., "Bearer example^com-SomeIdString").

Query Parameters:

  • type Specify type of SES
    for Transactional OTP (e.g., type:"OTP").
    for Promotional Bulk (e.g., type:"TMP").
    for Informational personalized (e.g., type:"CXT").

Body Parameters:

  • mailId Specify the array of mail address
    (e.g., ["email@domain.com"]).
  • :data Specify the mail OTP|TMP|CXT string
    for Transactional OTP (e.g., OTP:"000000").
    for Promotional Bulk (e.g., TMP:"template-id-here").
    for Informational personalized (e.g., CXT:"html-email").

Route Parameters:

  • :region *Please check location table here
    (e.g., "WEST_3|ARAB_1|EAST_3|NORD_6").

Response based on params:

{
  "success": true,
  "info": "SES OTP Sent!"
}

POST

check_boxNoAuthcheck_box_outline_blankLoyaltycheck_box_outline_blankEnterprise

This endpoint provides the mail for sending bulk email.

JavaScript
Python
Php
Java
c#
Ruby
Go
Swift
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
    "net/url"
)

func main() {
    result, err := fetchData()
    if err != nil {
        fmt.Printf("Error: %v\n", err)
        return
    }

    prettyJSON, _ := json.MarshalIndent(result, "", "  ")
    fmt.Println(string(prettyJSON))
}

func fetchData() (map[string]interface{}, error) {
    // API configuration
    baseURL := "https://mailpress.api.koirang.com/v1/:region"
    params := map[string]string{
        "region": "YOUR_REGION", // Replace with actual region value
    }
    headers := map[string]string{
        "Content-Type":  "application/json",
        "Authorization": "Bearer <privateId>",
    }
    queryParams := {"mailId":"example@domain.com","OTP":"000000"}

    // Build URL
    urlBuilder, err := url.Parse(baseURL)
    if err != nil {
        return nil, err
    }

    // Add path parameters
    pathParams := ["region"]
    path := urlBuilder.Path
    for _, param := range pathParams {
        path += "/" + url.PathEscape(params[param])
    }
    urlBuilder.Path = path

    // Add query parameters
    q := urlBuilder.Query()
    for key, value := range queryParams {
        q.Add(key, value)
    }
    urlBuilder.RawQuery = q.Encode()

    // Create request body for POST/PUT
    var reqBody []byte
    if "GET" == "POST" || "GET" == "PUT" {
        reqBody, err = json.Marshal({"type":"OTP"})
        if err != nil {
            return nil, err
        }
    }

    // Create request
    req, err := http.NewRequest("GET", urlBuilder.String(), bytes.NewBuffer(reqBody))
    if err != nil {
        return nil, err
    }

    // Set headers
    for key, value := range headers {
        req.Header.Set(key, value)
    }

    // Send request
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        return nil, err
    }
    defer resp.Body.Close()

    // Check for errors
    if resp.StatusCode >= 400 {
        return nil, fmt.Errorf("HTTP error! status: %d", resp.StatusCode)
    }

    // Read response
    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        return nil, err
    }

    // Parse JSON response
    var result map[string]interface{}
    err = json.Unmarshal(body, &result)
    if err != nil {
        return nil, err
    }

    return result, nil
}