Skip to content

github-meetk/simple-nodemailer-email-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-nodemailer-email-service

It is a Package to simply send email with just few lines of codes.

INSTALLING

npm install simple-nodemailer-email-service

What it is used for?

  • It is used to simply write send email logic directly on your node.js file.

Benefits

-It is very easy to use and quickly get started. -It uses SMTP server of gmail.

EXAMPLE USAGE

//First import this in your js file.

import { sendEmail } from "simple-nodemailer-email-service";

//Second, Create options object like given below:

const options = {
    from : 'Senders Email Address',
    password : 'Senders Email App password',  // you can get your App password from your google account
    to : 'Receivers Email Address',
    title : "Test",                           //Email Subject
    body : '<h1>Test successful...</h1>'      //Email message
}

//Third, Simply just call this function with "options" parameter

try{
  sendEmail(options).then(response => console.log(response));  //actually it is not neccessary to console log this response.
}catch(e){
  console.error(e);
}

EXAMPLE USAGE - using async/await

//First import this in your js file.

import { sendEmail } from "simple-nodemailer-email-service";

//Second, Create options object like given below:

const options = {
    from : 'Senders Email Address',
    password : 'Senders Email App password',  // you can get your App password from your google account
    to : 'Receivers Email Address',
    title : "Test",                           //Email Subject
    body : '<h1>Test successful...</h1>'      //Email message
}

//Third, Simply just call this function with "options" parameter

try {
	const response = await sendEmail(options);
	console.log(response);
} catch (err) {
	console.error(err);
}

Author

Meet Kalathiya

Contributions

issues and pull requests are welcome

About

It is a Package to simply send email with just few lines of codes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published