Email quickstart
Send your first email with a test key before you set up a domain: nothing is delivered and nothing is charged.
Quickstart
With a test key you can send before setting up a domain: send from onboarding@test.honkio.ca to one of the test addresses below. Nothing is delivered and nothing is charged.
import { Honkio } from '@honkio/node'
const honkio = new Honkio(process.env.HONKIO_API_KEY)
const { data, error } = await honkio.emails.send({
from: 'Acme <onboarding@test.honkio.ca>',
to: 'delivered@test.honkio.ca',
subject: 'Hello from HonkIO',
html: '<p>It works.</p>',
})
if (error) console.error(error.name, error.message)
else console.log(data.id)import os
from honkio import Honkio
client = Honkio(os.environ["HONKIO_API_KEY"])
sent = client.emails.send(
from_="Acme <onboarding@test.honkio.ca>",
to="delivered@test.honkio.ca",
subject="Hello from HonkIO",
html="<p>It works.</p>",
)
print(sent["id"])<?php
use Honkio\Honkio;
$honkio = new Honkio(getenv('HONKIO_API_KEY'));
$email = $honkio->emails->send([
'from' => 'Acme <onboarding@test.honkio.ca>',
'to' => 'delivered@test.honkio.ca',
'subject' => 'Hello from HonkIO',
'html' => '<p>It works.</p>',
]);
echo $email['id'], "\n";curl -X POST https://api.honkio.ca/v1/emails \
-H "Authorization: Bearer mk_test_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Acme <onboarding@test.honkio.ca>",
"to": "delivered@test.honkio.ca",
"subject": "Hello from HonkIO",
"html": "<p>It works.</p>"
}'
# Response 201: { "id": "cm...", "status": "queued", "scheduled_at": null }const res = await fetch('https://api.honkio.ca/v1/emails', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.HONKIO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
from: 'Acme <onboarding@test.honkio.ca>',
to: 'delivered@test.honkio.ca',
subject: 'Hello from HonkIO',
html: '<p>It works.</p>',
}),
})
console.log(res.status, await res.json())See the SDK reference for every resource, with examples.
Then add your own domain, switch to a live key, and send from an address on that domain.
HonkIO