Skip to main content

Prerequisites

Send email

const MAILRIFY_API_KEY = 'YOUR_API_KEY';

export const handler = async(event) => {
  const res = await fetch('https://app.mailrify.com/api/v1/emails', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${MAILRIFY_API_KEY}`
    },
    body: JSON.stringify({
      from: 'Your app <[email protected]>',
      to: '[email protected]',
      subject: 'Welcome to Mailrify 🚀',
      html: '<p>It works! 👋</p>',
      text: 'It works!'
    })
  });

  if (res.ok) {
    const data = await res.json();

    return {
      statusCode: 200,
      body: data,
    };
  }
};

More

  • Explore the API Reference to discover additional endpoints you can call from AWS Lambda for workflows beyond sending a single email.