1. Products
  2.   Email
  3.   Node.js
  4.   Candymail
 
  

Free Nodd.js Email Automation API for Emails Sending

Open Source Node.js Email Automation Library that Supports HTML Content, Attachment Capabilities, Multiple Recipient Handling, and Custom Headers in Node.js Apps.

What is Candymail API?

In today’s software development, having email capabilities is essential. It lets you stay in touch with users by sending notifications, confirmations, and promotional emails. If you’re a developer seeking an easy way to add email functions to your apps, check out the Candymail library on GitHub. It’s a handy tool created for Node.js applications, making it simple to handle email tasks like crafting, organizing, and sending messages. This tool offers a user-friendly platform for developers, making it easy to add and personalize email features. The system is designed to be effective and dependable, managing the intricacies of email exchanges, freeing up developers to concentrate on enhancing their main app.

Candymail is designed to manage lots of emails smoothly. It makes sure your messages get to where they need to go quickly and dependably. If you’re a developer, you can tweak your emails a lot. You can adjust the subject lines, the message itself, and who gets it. The library has key features like making and sending simple emails, sending emails with HTML content, adding attachments, sending emails to many people at once, sending emails with custom headers, and many more. It provides robust error handling mechanisms to ensure that developers can gracefully handle any issues that arise during the email sending process. The API is designed with simplicity in mind. Its documentation is comprehensive, and the API endpoints are intuitive, making it easy for developers to get started quickly.

Previous Next

Getting Started with Candymail

The recommend way to install Candymail is using NPM. Please use the following command for a smooth installation.

Install Candymail via npm

npm install --save candymail
 

Install Candymail via Yarn

yarn add candymail
 

Simple Email Creation & Sending in Node.js

The open source Candymail email API has provide very easy to use functionality for creating and sending simple as well as complex email messages inside Node.js environment. This simplicity allows developers to integrate email functionality with minimal code. The API allows to create, share and reuse email marketing strategies between different products. Software developers can attach different types of documents inside their email messages. Here is a simple example that shows, how software developers can send a basic email message from Node.js applications.

How to Send a Basic Email Messages inside Node.js Apps?

 
candymail.send({
  from: 'your-email@gmail.com',
  to: 'recipient@example.com',
  subject: 'Test Email',
  text: 'Hello, this is a test email sent via Candymail!'
})
.then(response => {
  console.log('Email sent successfully:', response);
})
.catch(error => {
  console.error('Error sending email:', error);
});

 

HTML Email Sending in Node.js Apps

The Candymail Node.js email API has provided complete support for sending HTML email messages, which allows for richer and more visually appealing email content. This is useful for marketing emails and other communications that benefit from enhanced formatting. It allows for the inclusion of attachments in emails, making it possible to send documents, images, and other files along with your messages. The following example shows, how easily developers can send an email with attachments inside Node.js applications.

How to Send an Email with Attachments via Node.js API?

 
const fs = require('fs');

candymail.send({
  from: 'your-email@gmail.com',
  to: 'recipient@example.com',
  subject: 'Email with Attachment',
  text: 'Please find the attached document.',
  attachments: [
    {
      filename: 'document.pdf',
      content: fs.createReadStream('path/to/document.pdf')
    }
  ]
})
.then(response => {
  console.log('Email with attachment sent successfully:', response);
})
.catch(error => {
  console.error('Error sending email with attachment:', error);
});

 

Send Emails to Multiple Recipients in Node.js

The open source Candymail email API makes it easy for software professionals and programmer to send emails to multiple recipients simultaneously inside Node.js applications. This is particularly useful for sending out notifications, updates, or any other bulk emails. It is also possible to include custom headers in emails, providing additional flexibility and control over email messages. Here is a simple example that shows, how to send email messages to multiple recipients with just a couple of lines of code, inside Node.js applications.

How to Send Email to Multiple Recipients inside Node.js Environment?

 
const sendEmailToMultipleRecipients = async () => {
  try {
    await candymail.send({
      to: ['recipient1@example.com', 'recipient2@example.com'],
      subject: 'Group Email',
      text: 'This email is sent to multiple recipients using Candymail.'
    });
    console.log('Email to multiple recipients sent successfully');
  } catch (error) {
    console.error('Error sending email to multiple recipients:', error);
  }
};

sendEmailToMultipleRecipients();