📧 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.
import DymoAPI from "dymo-api";
const dymo = new DymoAPI({
apiKey: "PRIVATE_TOKEN_HERE",
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
You can see the configuration parameters in detail here.
| Parameter | Type | Required | Description |
|---|---|---|---|
from | String | ✅ | Email sender |
to | String | ✅ | Receiving Email |
subject | String | ✅ | Email subject |
react (Only npm library) | React Component | ❌ | React Component (you must choose between this type or html) |
html | String | ❌ | HTML code to send in string format |
options | Options | ❌ | Additional parameters |
attachments | Attachment[] | ❌ | Optional Attachments |
Types
Options
| Parameter | Type | Required | Description |
|---|---|---|---|
waitToResponse | Boolean | ❌ | Wait for the email to be sent or simply check the connection (default true) |
priority | "high" | "normal" | "low" | undefined | ❌ | Email priority (default: normal) |
composeTailwindClasses (Only npm library) | Boolean | ❌ | Convert basic Tailwind CSS classes to inline styles |
compileToCssSafe | Boolean | ❌ | Convert your CSS to an older version of CSS supported by Gmail and others (default false) |
onlyVerifiedEmails | Boolean | ❌ | Avoid sending emails that will never be read (default false) - Additional cost of 0.05 credits |
Find more information about these options here.
Attachment
| Parameter | Type | Required | Description |
|---|---|---|---|
filename | String | ✅ | File name |
path | String (Relative, absolute or URL path) | ❌ | File path (instead of using content) |
content | String (Buffer) | ❌ | File buffer (instead of using path) |
cid | String | ❌ | CID of the file (if not specified, filename will be used) |
Information on the different parameters
Additional information
About Node environments
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.