📧 Sender / Send Email

Send Emails at Lightning Speed.

About Send Email Feature

Why should I use this feature?

This feature of Sender by Dymo allows you to send emails quickly and securely.

You will be able to send personalized, automated, marketing emails and much more!

How do I do it?

This feature supports HTML to send in your emails, even your custom React component (only in the npm library).

Usage

Once we have created and configured our API object, it is quite simple, we just need to execute the following code.

Dymo Sender intelligently uses headers and other parameters when sending emails to prevent them from ending up in SPAM or being discarded by the user.
import DymoAPI from "dymo-api";

const dymo = new DymoAPI({
  apiKey: "",
  serverEmailConfig: {
    host: "smtp.company.com",
    port: 587,
    secure: false,
    auth: {
      user: "no-reply",
      pass: process.env.NOREPLY_EMAIL_PASSWORD
    }
  }
});

console.log(await dymo.sendEmail({
  from: "[email protected]",
  to: "[email protected]",
  subject: "Welcome to Example!", 
  react: <WelcomeEmail name="Jack" />,
  // Optional but recommended if using Tailwind CSS (only for npm library).
  options: {
      composeTailwindClasses: true,
      compileToCssSafe: true, // Convert the CSS to be valid in clients such as Gmail.
      onlyVerifiedEmails: true // Additional cost (does not include proxied emails).
  }
}));

// or

console.log(await dymo.sendEmail({
  from: "[email protected]",
  to: "[email protected]",
  subject: "Welcome to Example!",
  html: "<html>Hi Jack!</html>",
  // Optional but recommended if using Tailwind CSS (only for npm library).
  options: {
      composeTailwindClasses: true,
      compileToCssSafe: true, // Convert the CSS to be valid in clients such as Gmail.
      onlyVerifiedEmails: true // Additional cost (does not include proxied emails).
  }
}));

Response

{
  status: true
}                             

Parameters

Authorization
String
required

You can see the configuration parameters in detail here.


Email Client
Dashboard
required
ParameterTypeRequiredDescription
fromStringEmail sender
toStringReceiving Email
subjectStringEmail subject
react (Only npm library)React ComponentReact Component (you must choose between this type or html)
htmlStringHTML code to send in string format
optionsOptionsAdditional parameters
attachmentsAttachment[]Optional Attachments

Types

Options

ParameterTypeRequiredDescription
waitToResponseBooleanWait for the email to be sent or simply check the connection (default true)
priority"high" | "normal" | "low" | undefinedEmail priority (default: normal)
composeTailwindClasses (Only npm library)BooleanConvert basic Tailwind CSS classes to inline styles
compileToCssSafeBooleanConvert your CSS to an older version of CSS supported by Gmail and others (default false)
onlyVerifiedEmailsBooleanAvoid sending emails that will never be read (default false) - Additional cost of 0.05 credits

Find more information about these options here.

Attachment

ParameterTypeRequiredDescription
filenameStringFile name
pathString (Relative, absolute or URL path)File path (instead of using content)
contentString (Buffer)File buffer (instead of using path)
cidStringCID of the file (if not specified, filename will be used)
Please note that the maximum total size cannot exceed 40MB.

Information on the different parameters

Additional information

About Node environments

Due to one of the React to HTML conversion dependencies in the Dymo API library for npm it will not be possible to use (at least for the moment) the Jest test library to execute the email sending.

About styles in HTML

It is important to keep in mind that the styles may vary depending on the email client (especially if you send the styles using Tailwind CSS for Dymo to compile them) used by the person receiving the message, so we must be as specific as possible in the styles.

About React components

Styles must be sent together with the component, i.e. utilities like Tailwind CSS will not work (unless configured in the email option: example above) as they do not send the styles but only the classes.