Api¶
Send Mail¶
Request Method : POST
Endpoint : https://mail.dailymails.org/api/v1/mail/send/
Content-Type : application/x-www-form-urlencoded
Request Parameters¶
NAME |
Type |
Description |
Required |
---|---|---|---|
api
|
String
|
The api key of your account
|
True
|
username
|
String
|
The username of your account
|
True
|
from
|
String
|
Specify a Sender email address
|
True
|
to
|
String
|
Specify a Recipient email address
|
True
|
subject
|
String
|
The subject of your email
|
True
|
message
|
String
|
The HTML content of your email message
|
True
|
Api Results¶
Name |
Result |
---|---|
status
|
success|fail
|
message
|
Send|Queued
|
id
|
Message id of emails.
|
error
|
(if status was fail) describes why the query failed,
Request method is not correct.
Required parameter missing or invalid.
User authentication failed. Wrong API Key or username.
Domain authentication failed. Unverified Sender found.
The request was refused due to insufficent credit.
|
Curl¶
curl -X POST https://mail.dailymails.org/api/v1/mail/send/
-d "username=your_username
&api=your_api_key
&to=sampleuser@example.com
&from=admin@yourdomain.com
&subject=This is a test email
&message=Hi, this is my first test mail"
C#¶
var client = new RestClient("https://mail.dailymails.org/api/v1");
var request = new RestRequest("mail/send/", Method.POST);
request.AddParameter("username", "your_username");
request.AddParameter("api", "your_api_key");
request.AddParameter("from", "admin@yourdomain.com");
request.AddParameter("to", "sampleuser@example.com");
request.AddParameter("subject", "This is a test email");
request.AddParameter("message", "Hi, this is my first test mail");
var httpResponse = client.Execute(request);
string json = httpResponse.Content.ToString();
Console.WriteLine(json);
Ruby¶
require 'uri'
require 'net/http'
url = URI("https://mail.dailymails.org/api/v1/mail/send/")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/x-www-form-urlencoded"
request.set_form_data({"username" => "your_username",
"api" => "your_api_key",
"to" => "sampleuser@example.com", "from" => "admin@yourdomain.com",
"subject" => "This is a test email",
"message" => "Hi, this is my first test mail"})
response = http.request(request)
puts response.read_body
Php¶
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://mail.dailymails.org/api/v1/mail/send/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "username=your_username&api=your_api_key
&to=sampleuser@example.com
&from=admin@yourdomain.com
&subject=This is a test email
&message=Hi, this is my first test mail");
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$head = curl_exec($ch);
echo $head;
Python¶
import requests
payload = {'username': 'your_username',
'api': 'your_api_key',
'to': 'sampleuser@example.com',
'from': 'admin@yourdomain.com',
'subject': 'This is a test email',
'message': 'Hi, this is my first test mail'}
url="https://mail.dailymails.org/api/v1/mail/send/"
response=requests.post(url,data=payload)
print response.text
NODEJS¶
1. Nodejs Native Example
var http = require("http");
const postData = "username=your_username
&api=your_api_key
&to=sampleuser@example.com
&from=admin@yourdomain.com
&subject=This is a test email
&message=Hi, this is my first test mail"
var options = {
"method": "POST",
"hostname": "https://mail.dailymails.org",
"port": null,
"path": "/api/v1/mail/send/",
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(postData)
}
};
var req = http.request(options, function (res) {
res.setEncoding('utf8');
res.on("data", function (chunk) {
console.log(chunk);
});
res.on("end", function () {
console.log("completed");
}); });
req.write(postData);
req.end();