Introduction
User tutorial
Other
SDK
Mailik - The React email collector
Base syntax for sending emails
const mailikResult = await Mailik(AUTH_KEY).send({
body: MAIL_BODY,
replyTo: REPLY_TO,
subject: SUBJECT,
});
Authentication / parameters
publicKey: String! The public key header.
body: String! The body of the email. Can be in HTML format.
subject: String! The subject of the email.
replyTo: String! The email address to reply to.
Result
response.status === "OK" Mail was sent successfully
response.status === "FAILED" Backed rejected the request
response.errorMessage Information about network error
Schema URL
Schema is available at https://mailik.aexol.work/graphql
Code example in TypeScript
import Mailik from "@mailik/sdk";
type MailInputType = { body: string; subject: string; replyTo: string };
const handleSubmit = (values: MailInputType) => {
const res = await Mailik(YOURS_API_KEY).send({
replyTo: data.email,
body: `
Name:${data.name},
Message: ${data.message},
Phone:${data.phone}
`,
subject: "Mail subject",
});
if (res.status === "OK") {
console.log("Mail send!");
return;
}
console.log("Status", res.status);
console.log("Message", res.message);
console.log("Network error", res.errorMessage);
};