Mail API
Send mail through an authenticated mailbox over HTTPS.
Endpoint
POST https://api.ewodi.net/send.php
Send a JSON request with Content-Type: application/json.
Request
{
"email": "user@example.com",
"password": "mailbox-password",
"from": "user@example.com",
"from_name": "Your Name",
"to": "recipient@example.net",
"cc": ["copy@example.net"],
"bcc": ["hidden-copy@example.net"],
"subject": "Test message",
"text": "Hello from the Mail API",
"html": "<p>Hello from the Mail API</p>"
}
| Field | Required | Description |
|---|---|---|
email | Yes | Mailbox used for SMTP authentication. |
password | Yes | Mailbox or application password. Never expose it in client-side code. |
from | No | Visible sender address. Must match email. |
from_name | No | Visible sender name, equivalent to PHPMailer’s second setFrom() argument. |
to | Yes | Primary recipient address. |
cc, bcc | No | One address, comma-separated addresses, or an array. Display names are supported. |
subject | Yes | Message subject, up to 255 characters. |
text, html | One required | Plain-text and/or HTML message body. When both are supplied, text is the alternative body. |
Examples
Option 1: JSON file
Best for repeated requests and scripts. Create request.json first:
{
"email": "user@example.com",
"password": "mailbox-password",
"to": "recipient@example.net",
"subject": "Test message",
"text": "Hello from the Mail API"
}
curl -i https://api.ewodi.net/send.php \
-H 'Content-Type: application/json' \
--data-binary @request.json
Option 2: One self-contained command
Useful for a quick test. Replace the example values before running it:
curl -i https://api.ewodi.net/send.php \
-H 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com",
"password": "mailbox-password",
"to": "recipient@example.net",
"subject": "Test message",
"text": "Hello from the Mail API"
}'
Option 3: HTML email
Include both text and html when sending formatted mail:
curl -i https://api.ewodi.net/send.php \
-H 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com",
"password": "mailbox-password",
"to": "recipient@example.net",
"subject": "Welcome",
"text": "Welcome to our service.",
"html": "<p>Welcome to our <strong>service</strong>.</p>"
}'
Option 1 is recommended for production scripts. Never put the mailbox password in a URL, source repository, browser code, or shared logs. The inline examples can also appear in shell history.
Client examples
PHP (cURL extension)
<?php
$payload = [
'email' => 'user@example.com',
'password' => 'mailbox-password',
'to' => 'recipient@example.net',
'subject' => 'Test message',
'text' => 'Hello from PHP',
];
$curl = curl_init('https://api.ewodi.net/send.php');
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload, JSON_THROW_ON_ERROR),
]);
$response = curl_exec($curl);
if ($response === false) {
throw new RuntimeException(curl_error($curl));
}
echo curl_getinfo($curl, CURLINFO_HTTP_CODE) . "\n";
echo $response . "\n";
curl_close($curl);
Python (standard library)
import json
from urllib.request import Request, urlopen
payload = {
"email": "user@example.com",
"password": "mailbox-password",
"to": "recipient@example.net",
"subject": "Test message",
"text": "Hello from Python",
}
request = Request(
"https://api.ewodi.net/send.php",
data=json.dumps(payload).encode("utf-8"),
headers={"Content-Type": "application/json"},
method="POST",
)
with urlopen(request) as response:
print(response.status)
print(response.read().decode("utf-8"))
Java (Java 11+)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class MailApiExample {
public static void main(String[] args) throws Exception {
String json = "{"
+ "\"email\":\"user@example.com\","
+ "\"password\":\"mailbox-password\","
+ "\"to\":\"recipient@example.net\","
+ "\"subject\":\"Test message\","
+ "\"text\":\"Hello from Java\""
+ "}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.ewodi.net/send.php"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
Go (standard library)
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"email":"user@example.com","password":"mailbox-password","to":"recipient@example.net","subject":"Test message","text":"Hello from Go"}`)
request, err := http.NewRequest(
http.MethodPost,
"https://api.ewodi.net/send.php",
bytes.NewReader(payload),
)
if err != nil {
panic(err)
}
request.Header.Set("Content-Type", "application/json")
response, err := http.DefaultClient.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
panic(err)
}
fmt.Println(response.StatusCode)
fmt.Println(string(body))
}
Ruby (standard library)
require 'json'
require 'net/https'
require 'uri'
uri = URI('https://api.ewodi.net/send.php')
payload = {
email: 'user@example.com',
password: 'mailbox-password',
to: 'recipient@example.net',
subject: 'Test message',
text: 'Hello from Ruby'
}
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = JSON.generate(payload)
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.code
puts response.body
JavaScript (Node.js 18+)
Use this on a trusted server. Do not put mailbox credentials in browser JavaScript.
async function main() {
const payload = {
email: "user@example.com",
password: "mailbox-password",
to: "recipient@example.net",
subject: "Test message",
text: "Hello from Node.js"
};
const response = await fetch("https://api.ewodi.net/send.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload)
});
console.log(response.status);
console.log(await response.text());
}
main().catch(console.error);
Responses
| Status | Meaning |
|---|---|
202 | Message accepted for delivery. |
400 | Invalid request, recipient, sender, subject, or body. |
401 | Invalid mailbox credentials. |
403 | Sender address does not match the authenticated mailbox. |
405 | POST is required. |
413 | Request or message is too large. |
415 | JSON content type is required. |
429 | Rate limit exceeded. Honor the Retry-After header. |
502, 503 | Mail submission or service failure. |
Limits and security
- HTTPS is required.
- Requests are limited to 2 MiB; individual text or HTML bodies are limited to 1.5 MiB.
- Each mailbox is limited to 20 submissions per minute and 200 per hour, in addition to the client IP limit.
- Use an application password where supported, and keep credentials on a trusted server.
- Only use HTML from trusted or properly sanitized sources.