Sending emails in a Node.js application can be done using various libraries and services such as Nodemailer, Sendgrid, and Amazon SES. Below is an example of how to do it with Nodemailer.
1. Install Nodemailer.
```
npm install nodemailer
```
1. Obtain SMTP server details. SMTP (Simple Mail Transfer Protocol) is the protocol that mail servers use to send emails. You need to obtain the details of the SMTP server you will use. For example, if you’re using Gmail, the SMTP server is smtp.gmail.com.
1. Setup NodeMailer.
```
var nodemailer = require(‘nodemailer’);
var transporter = nodemailer.createTransport({
service: ‘gmail’,
auth: {
user: ‘youremail@gmail.com’,
pass: ‘yourpassword‘
}
});
```
1. Define the email options.
```
var mailOptions = {
from: ‘youremail@gmail.com’,
to: ‘myfriend@yahoo.com’,
subject: ‘Sending Email using Node.js’,
text: ‘That was easy!‘
};
```
1. Send email with `sendMail` method.
```
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log(‘Email sent: ‘ + info.response);
}
});
```
This is just a simple example. You can customize the emails you send in various ways, such as using HTML templates, including attachments, and more. Also remember, for production applications, it’s best to use OAuth2 for authorization or use a professional email sending service like Sendgrid or Amazon SES that provides more features.