Skip to content

Bug fixed for issue #1305 #1306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions JavaScript/Send_Emails/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
## About The Project

This script enables the user to send emails.
It is written in Javascript.
The nodemailer package is used.
InquirerJs is used to get user inputs.
The necessary details are changed in the script and the email is sent.
The less secure apps feature must be enabled in the email service to enable emails to be sent from the program.

### Built With

* [Inquirer.Js](https://github.com/SBoudrias/Inquirer.js/)
* [Nodemailer](https://github.com/nodemailer/nodemailer)


Clone the repo

Change Directory into the repository
```sh
cd [into the folder]
```
Install the NPM package globally
```sh
npm install -g
```
For Linux :
```sh
sudo npm install -g
```


<!-- USAGE EXAMPLES -->
## Usage

Sendmail is a cli to send emails from the terminal itself :
```sh
sendmail
```
32 changes: 32 additions & 0 deletions JavaScript/Send_Emails/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const nodemailer = require('nodemailer');


function authorization(email, password, mailDetails){

// This part verifies the password of the mail from the user

let login_and_auth = nodemailer.createTransport({
service: 'gmail',
//Any email service can be used here
auth: {
user: email,
pass: password
}
});

//This part consists of the details of the to send to the receiver's mail
//Also makes a connection with the server and sends the email.

login_and_auth.sendMail(mailDetails, function(err, data) {
if(err) {
console.log(err.message)
console.log('Unable to send the email');
}
else {
console.log('Email sent');
}
});
}

module.exports = {authorization: authorization}

Loading