Transactional API
Prerequisite
Send Mail
1. API URL
POST https://mail.dailymails.org/api/v1/mail/send/ Content-Type : application/x-www-form-urlencoded
Parameters
1. api: The api key of your account.
2. username: The username of your account.
3. from: Specify a Sender email address.
4. to : Specify a Recipient email address.
5. subject : The subject of your email
6. message : The HTML content of your email message.
API Results
1. status: success|fail
2. message: Send|Queued
3. id: Message id of emails.
4. 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.
Sample Codes
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"
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
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();
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
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);
$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;