Skip to main content
After initializing the Shootmail client, use shoot method to send mail
import { Shootmail, type ShootMailConfig } from "shootmail";
const shootmail = new Shootmail(shootmailConfig);
shootmail.shoot(params);

How to copy mail variables form playground

Send Mail

const response = await shootmail.shoot({
    templateId: "kthiazpqofgnrtm",
    from: {
        name: "Shootmail",
        email: "noreply@mail.example.app"
    },
    provider: "resend",
    to: [{ email: "hi@example.com" }],
    subject: "Regarding your Shootmail subscription",
    variables: [...]
});

Params

templateId
string
required
Template Id of the template you want to use. This can be copied from Templates
delay
number
Schedule a message to some time in future. Pass delay in seconds. For example: to send after 7 days, delay: 7*24*60*60
from
Object
required
This should be the email verified with your email service
provider
string
required
Use shootmail here. If you are using some other email service, you can select that provider, check docs.
to
Array
required
An array of email addresses to the people you want to send the mails to.
subject
string
required
Subject of the email
variables
Array
required
The variables to be passed to the template to build the email. You can copy this from the mail playground and modify according to your needs. See Video

Schedule Mail

  const response = await shootmail.shoot({
      delay: 60 //seconds
      ...
  })
Schedule a message to some time in future. Pass delay in seconds. For example: to send after 7 days, delay: 7*24*60*60

Undo Mail

const response = await shootmail.undoSchedule(requestId);
Here requestId is the one received in the response of the method shootmail.shoot().