PappyMail API

Powerful email sending API for developers. Integrate email into your applications with just a few lines of code.

Lightning Fast

Send emails in milliseconds with our optimized infrastructure

Secure & Reliable

Enterprise-grade security with 99.9% uptime guarantee

Real-time Analytics

Track deliveries, opens, clicks, and more

Quick Start Guide

1 Get Your API Key

Sign up and navigate to IT Department → Email System → API Keys to generate your API key.

2 Verify Your Domain

Add and verify your sending domain in IT Department → Email Domains.

3 Send Your First Email

Use the code examples below to send your first email.

API Reference

POST /api/v1/mail/send
Send Email

Send a single email to one or more recipients.

Authentication

Include your API key in the request header:

Authorization: Bearer YOUR_API_KEY

Or:

X-API-Key: YOUR_API_KEY
Request Body
{
  "from": {
    "email": "sender@yourdomain.com",
    "name": "Your Name"
  },
  "to": [
    {
      "email": "recipient@example.com",
      "name": "Recipient Name"
    }
  ],
  "subject": "Your email subject",
  "html_content": "<h1>Hello World</h1><p>This is a test email.</p>",
  "text_content": "Hello World. This is a test email."
}
Response
{
  "message_id": "msg_abc123xyz",
  "status": "queued",
  "message": "Email queued for delivery"
}
GET /api/v1/mail/stats
Get API Usage Statistics

Retrieve your current API usage and limits.

Response
{
  "daily_usage": 150,
  "daily_limit": 1000,
  "monthly_usage": 3500,
  "monthly_limit": 50000,
  "last_used": "2025-11-09T10:30:00Z",
  "reset_date": "2025-11-09T00:00:00Z"
}

SDK & Code Examples

curl -X POST https://pappymall.com/api/v1/mail/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {
      "email": "sender@yourdomain.com",
      "name": "Your Name"
    },
    "to": [
      {
        "email": "recipient@example.com",
        "name": "Recipient"
      }
    ],
    "subject": "Hello from PappyMail",
    "html_content": "

Hello World

This is a test email.

" }'

Official SDKs & Libraries

SDK Libraries & Implementation

Node.js / JavaScript
Installation:
npm install axios
# or
yarn add axios
Implementation:
const axios = require('axios');

class PappyMailClient {
    constructor(apiKey) {
        this.apiKey = apiKey;
        this.baseURL = 'https://pappymall.com/api/v1/mail';
    }

    async sendEmail(data) {
        try {
            const response = await axios.post(`${this.baseURL}/send`, {
                from: data.from,
                to: data.to,
                subject: data.subject,
                html_content: data.html_content,
                text_content: data.text_content,
                cc: data.cc,
                bcc: data.bcc
            }, {
                headers: {
                    'Authorization': `Bearer ${this.apiKey}`,
                    'Content-Type': 'application/json'
                }
            });
            return response.data;
        } catch (error) {
            throw new Error(`PappyMail API Error: ${error.response?.data?.message || error.message}`);
        }
    }

    async getStats() {
        try {
            const response = await axios.get(`${this.baseURL}/stats`, {
                headers: {
                    'Authorization': `Bearer ${this.apiKey}`
                }
            });
            return response.data;
        } catch (error) {
            throw new Error(`PappyMail API Error: ${error.message}`);
        }
    }
}

// Usage Example
const client = new PappyMailClient('pm_live_your_api_key');

client.sendEmail({
    from: { email: 'noreply@yourdomain.com', name: 'Your App' },
    to: [{ email: 'customer@example.com', name: 'Customer Name' }],
    subject: 'Welcome to Our Service',
    html_content: '<h1>Welcome!</h1><p>Thank you for signing up.</p>'
}).then(result => {
    console.log('Email sent:', result.message_id);
}).catch(error => {
    console.error('Error:', error.message);
});
Python
Installation:
pip install requests
Implementation:
import requests
from typing import List, Dict, Optional

class PappyMailClient:
    def __init__(self, api_key: str):
        self.api_key = api_key
        self.base_url = 'https://pappymall.com/api/v1/mail'
        self.headers = {
            'Authorization': f'Bearer {api_key}',
            'Content-Type': 'application/json'
        }
    
    def send_email(
        self,
        from_email: Dict[str, str],
        to: List[Dict[str, str]],
        subject: str,
        html_content: Optional[str] = None,
        text_content: Optional[str] = None,
        cc: Optional[List[Dict[str, str]]] = None,
        bcc: Optional[List[Dict[str, str]]] = None
    ) -> Dict:
        """Send an email via PappyMail API"""
        payload = {
            'from': from_email,
            'to': to,
            'subject': subject
        }
        
        if html_content:
            payload['html_content'] = html_content
        if text_content:
            payload['text_content'] = text_content
        if cc:
            payload['cc'] = cc
        if bcc:
            payload['bcc'] = bcc
        
        response = requests.post(
            f'{self.base_url}/send',
            json=payload,
            headers=self.headers
        )
        response.raise_for_status()
        return response.json()
    
    def get_stats(self) -> Dict:
        """Get API usage statistics"""
        response = requests.get(
            f'{self.base_url}/stats',
            headers=self.headers
        )
        response.raise_for_status()
        return response.json()

# Usage Example
client = PappyMailClient('pm_live_your_api_key')

try:
    result = client.send_email(
        from_email={'email': 'noreply@yourdomain.com', 'name': 'Your App'},
        to=[{'email': 'customer@example.com', 'name': 'Customer Name'}],
        subject='Welcome to Our Service',
        html_content='<h1>Welcome!</h1><p>Thank you for signing up.</p>'
    )
    print(f"Email sent: {result['message_id']}")
except requests.exceptions.HTTPError as e:
    print(f"Error: {e.response.json()}")
Go
Installation:
# No external dependencies needed for basic HTTP client
Implementation:
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

type PappyMailClient struct {
    APIKey  string
    BaseURL string
}

type EmailRecipient struct {
    Email string `json:"email"`
    Name  string `json:"name,omitempty"`
}

type SendEmailRequest struct {
    From        EmailRecipient   `json:"from"`
    To          []EmailRecipient `json:"to"`
    Subject     string           `json:"subject"`
    HTMLContent string           `json:"html_content,omitempty"`
    TextContent string           `json:"text_content,omitempty"`
    CC          []EmailRecipient `json:"cc,omitempty"`
    BCC         []EmailRecipient `json:"bcc,omitempty"`
}

type SendEmailResponse struct {
    MessageID string `json:"message_id"`
    Status    string `json:"status"`
    Message   string `json:"message"`
}

func NewPappyMailClient(apiKey string) *PappyMailClient {
    return &PappyMailClient{
        APIKey:  apiKey,
        BaseURL: "https://pappymall.com/api/v1/mail",
    }
}

func (c *PappyMailClient) SendEmail(req SendEmailRequest) (*SendEmailResponse, error) {
    jsonData, err := json.Marshal(req)
    if err != nil {
        return nil, fmt.Errorf("failed to marshal request: %w", err)
    }

    httpReq, err := http.NewRequest("POST", c.BaseURL+"/send", bytes.NewBuffer(jsonData))
    if err != nil {
        return nil, fmt.Errorf("failed to create request: %w", err)
    }

    httpReq.Header.Set("Authorization", "Bearer "+c.APIKey)
    httpReq.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(httpReq)
    if err != nil {
        return nil, fmt.Errorf("failed to send request: %w", err)
    }
    defer resp.Body.Close()

    var result SendEmailResponse
    if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
        return nil, fmt.Errorf("failed to decode response: %w", err)
    }

    return &result, nil
}

// Usage Example
func main() {
    client := NewPappyMailClient("pm_live_your_api_key")

    result, err := client.SendEmail(SendEmailRequest{
        From: EmailRecipient{
            Email: "noreply@yourdomain.com",
            Name:  "Your App",
        },
        To: []EmailRecipient{
            {Email: "customer@example.com", Name: "Customer Name"},
        },
        Subject:     "Welcome to Our Service",
        HTMLContent: "<h1>Welcome!</h1><p>Thank you for signing up.</p>",
    })

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

    fmt.Printf("Email sent: %s\n", result.MessageID)
}
.NET / C#
Installation:
dotnet add package System.Net.Http.Json
Implementation:
using System.Net.Http.Json;
using System.Text.Json.Serialization;

public class PappyMailClient
{
    private readonly HttpClient _httpClient;
    private const string BaseUrl = "https://pappymall.com/api/v1/mail";

    public PappyMailClient(string apiKey)
    {
        _httpClient = new HttpClient();
        _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
    }

    public async Task<SendEmailResponse> SendEmailAsync(SendEmailRequest request)
    {
        var response = await _httpClient.PostAsJsonAsync($"{BaseUrl}/send", request);
        response.EnsureSuccessStatusCode();
        return await response.Content.ReadFromJsonAsync<SendEmailResponse>();
    }

    public async Task<ApiStatsResponse> GetStatsAsync()
    {
        var response = await _httpClient.GetAsync($"{BaseUrl}/stats");
        response.EnsureSuccessStatusCode();
        return await response.Content.ReadFromJsonAsync<ApiStatsResponse>();
    }
}

public record EmailRecipient(
    [property: JsonPropertyName("email")] string Email,
    [property: JsonPropertyName("name")] string? Name = null
);

public record SendEmailRequest(
    [property: JsonPropertyName("from")] EmailRecipient From,
    [property: JsonPropertyName("to")] List<EmailRecipient> To,
    [property: JsonPropertyName("subject")] string Subject,
    [property: JsonPropertyName("html_content")] string? HtmlContent = null,
    [property: JsonPropertyName("text_content")] string? TextContent = null,
    [property: JsonPropertyName("cc")] List<EmailRecipient>? Cc = null,
    [property: JsonPropertyName("bcc")] List<EmailRecipient>? Bcc = null
);

public record SendEmailResponse(
    [property: JsonPropertyName("message_id")] string MessageId,
    [property: JsonPropertyName("status")] string Status,
    [property: JsonPropertyName("message")] string Message
);

// Usage Example
var client = new PappyMailClient("pm_live_your_api_key");

try
{
    var result = await client.SendEmailAsync(new SendEmailRequest(
        From: new EmailRecipient("noreply@yourdomain.com", "Your App"),
        To: new List<EmailRecipient> { new("customer@example.com", "Customer Name") },
        Subject: "Welcome to Our Service",
        HtmlContent: "<h1>Welcome!</h1><p>Thank you for signing up.</p>"
    ));

    Console.WriteLine($"Email sent: {result.MessageId}");
}
catch (HttpRequestException ex)
{
    Console.WriteLine($"Error: {ex.Message}");
}
PHP
Installation:
# Requires PHP 7.4+ with cURL extension enabled
Implementation:
<?php

class PappyMailClient
{
    private $apiKey;
    private $baseURL = 'https://pappymall.com/api/v1/mail';

    public function __construct($apiKey)
    {
        $this->apiKey = $apiKey;
    }

    public function sendEmail($data)
    {
        $ch = curl_init($this->baseURL . '/send');
        
        curl_setopt_array($ch, [
            CURLOPT_POST => true,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => [
                'Authorization: Bearer ' . $this->apiKey,
                'Content-Type: application/json'
            ],
            CURLOPT_POSTFIELDS => json_encode($data)
        ]);

        $response = curl_exec($ch);
        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);

        if ($httpCode !== 202) {
            throw new Exception('PappyMail API Error: ' . $response);
        }

        return json_decode($response, true);
    }

    public function getStats()
    {
        $ch = curl_init($this->baseURL . '/stats');
        
        curl_setopt_array($ch, [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => [
                'Authorization: Bearer ' . $this->apiKey
            ]
        ]);

        $response = curl_exec($ch);
        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);

        if ($httpCode !== 200) {
            throw new Exception('PappyMail API Error: ' . $response);
        }

        return json_decode($response, true);
    }
}

// Usage Example
$client = new PappyMailClient('pm_live_your_api_key');

try {
    $result = $client->sendEmail([
        'from' => ['email' => 'noreply@yourdomain.com', 'name' => 'Your App'],
        'to' => [['email' => 'customer@example.com', 'name' => 'Customer Name']],
        'subject' => 'Welcome to Our Service',
        'html_content' => '<h1>Welcome!</h1><p>Thank you for signing up.</p>'
    ]);

    echo "Email sent: " . $result['message_id'];
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}

?>
React / Next.js
Installation:
npm install axios
# or
yarn add axios
Implementation (React Hook):
// hooks/usePappyMail.js
import { useState } from 'react';
import axios from 'axios';

export const usePappyMail = (apiKey) => {
    const [loading, setLoading] = useState(false);
    const [error, setError] = useState(null);

    const sendEmail = async (emailData) => {
        setLoading(true);
        setError(null);
        
        try {
            const response = await axios.post(
                'https://pappymall.com/api/v1/mail/send',
                {
                    from: emailData.from,
                    to: emailData.to,
                    subject: emailData.subject,
                    html_content: emailData.htmlContent,
                    text_content: emailData.textContent,
                    cc: emailData.cc,
                    bcc: emailData.bcc
                },
                {
                    headers: {
                        'Authorization': `Bearer ${apiKey}`,
                        'Content-Type': 'application/json'
                    }
                }
            );
            
            setLoading(false);
            return response.data;
        } catch (err) {
            setError(err.response?.data?.message || err.message);
            setLoading(false);
            throw err;
        }
    };

    const getStats = async () => {
        try {
            const response = await axios.get(
                'https://pappymall.com/api/v1/mail/stats',
                {
                    headers: {
                        'Authorization': `Bearer ${apiKey}`
                    }
                }
            );
            return response.data;
        } catch (err) {
            throw new Error(err.response?.data?.message || err.message);
        }
    };

    return { sendEmail, getStats, loading, error };
};

// Usage in Component
import React, { useState } from 'react';
import { usePappyMail } from './hooks/usePappyMail';

export default function EmailForm() {
    const { sendEmail, loading, error } = usePappyMail('pm_live_your_api_key');
    const [status, setStatus] = useState('');

    const handleSubmit = async (e) => {
        e.preventDefault();
        
        try {
            const result = await sendEmail({
                from: { email: 'noreply@yourdomain.com', name: 'Your App' },
                to: [{ email: 'customer@example.com', name: 'Customer' }],
                subject: 'Welcome to Our Service',
                htmlContent: '<h1>Welcome!</h1><p>Thank you for signing up.</p>'
            });
            
            setStatus(`Email sent! ID: ${result.message_id}`);
        } catch (err) {
            setStatus(`Error: ${error}`);
        }
    };

    return (
        <form onSubmit={handleSubmit}>
            <button type="submit" disabled={loading}>
                {loading ? 'Sending...' : 'Send Email'}
            </button>
            {status && <p>{status}</p>}
        </form>
    );
}
Next.js API Route (Server-Side):
// pages/api/send-email.js
import axios from 'axios';

export default async function handler(req, res) {
    if (req.method !== 'POST') {
        return res.status(405).json({ error: 'Method not allowed' });
    }

    const apiKey = process.env.PAPPYMAIL_API_KEY; // Store in .env.local
    
    try {
        const response = await axios.post(
            'https://pappymall.com/api/v1/mail/send',
            {
                from: req.body.from,
                to: req.body.to,
                subject: req.body.subject,
                html_content: req.body.htmlContent,
                text_content: req.body.textContent
            },
            {
                headers: {
                    'Authorization': `Bearer ${apiKey}`,
                    'Content-Type': 'application/json'
                }
            }
        );

        res.status(200).json({
            success: true,
            messageId: response.data.message_id
        });
    } catch (error) {
        console.error('Email sending failed:', error.response?.data || error.message);
        res.status(500).json({
            success: false,
            error: error.response?.data?.message || 'Failed to send email'
        });
    }
}

// Usage in component:
// const response = await fetch('/api/send-email', {
//     method: 'POST',
//     headers: { 'Content-Type': 'application/json' },
//     body: JSON.stringify(emailData)
// });
TypeScript Version:
// lib/pappymail.ts
import axios, { AxiosError } from 'axios';

interface EmailRecipient {
    email: string;
    name?: string;
}

interface SendEmailRequest {
    from: EmailRecipient;
    to: EmailRecipient[];
    subject: string;
    htmlContent?: string;
    textContent?: string;
    cc?: EmailRecipient[];
    bcc?: EmailRecipient[];
}

interface SendEmailResponse {
    message_id: string;
    status: string;
    message: string;
}

export class PappyMailClient {
    private apiKey: string;
    private baseURL: string = 'https://pappymall.com/api/v1/mail';

    constructor(apiKey: string) {
        this.apiKey = apiKey;
    }

    async sendEmail(data: SendEmailRequest): Promise<SendEmailResponse> {
        try {
            const response = await axios.post<SendEmailResponse>(
                `${this.baseURL}/send`,
                {
                    from: data.from,
                    to: data.to,
                    subject: data.subject,
                    html_content: data.htmlContent,
                    text_content: data.textContent,
                    cc: data.cc,
                    bcc: data.bcc
                },
                {
                    headers: {
                        'Authorization': `Bearer ${this.apiKey}`,
                        'Content-Type': 'application/json'
                    }
                }
            );
            
            return response.data;
        } catch (error) {
            const axiosError = error as AxiosError<{ message: string }>;
            throw new Error(
                axiosError.response?.data?.message || 
                axiosError.message
            );
        }
    }

    async getStats() {
        const response = await axios.get(`${this.baseURL}/stats`, {
            headers: {
                'Authorization': `Bearer ${this.apiKey}`
            }
        });
        return response.data;
    }
}

// Usage
const client = new PappyMailClient(process.env.NEXT_PUBLIC_PAPPYMAIL_API_KEY!);
const result = await client.sendEmail({
    from: { email: 'noreply@yourdomain.com', name: 'Your App' },
    to: [{ email: 'customer@example.com', name: 'Customer Name' }],
    subject: 'Welcome',
    htmlContent: '<h1>Hello!</h1>'
});
Quick Reference
Language HTTP Library Installation
Node.js axios or node-fetch npm install axios
Python requests pip install requests
Go net/http (built-in) No installation needed
.NET HttpClient (built-in) dotnet add package System.Net.Http.Json
PHP cURL (built-in) Enable cURL extension
React/Next.js axios or fetch npm install axios

Ready to Start Sending?

Join thousands of developers using PappyMail API

Get Started Free