Skip to content
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

Sending Attendance Excel Sheet to parents #3

Open
ShreyashSiddharth opened this issue May 5, 2023 · 0 comments
Open

Sending Attendance Excel Sheet to parents #3

ShreyashSiddharth opened this issue May 5, 2023 · 0 comments

Comments

@ShreyashSiddharth
Copy link

ShreyashSiddharth commented May 5, 2023

Pre Req - Input in student sign-up asking for parents Mail Addresses
Installing NodeMailer - npm install nodemailer -- save

Insert this code in app.js (Node JS backend file)

const nodemailer = require("nodemailer")

const transporter = nodemailer.createTransport({
    service:"hotmail",
    auth :{
       user :"[email protected]" ,// example outlook email
       pass :"" // password
    }

});
const options = {
  from:"[email protected]" ,// example outlook mail
  to :"[email protected]" ,// recievers mail
  subject: "Attendance Record" , 
  text : "attendance Record" , 
  attachments:[
    {   // use URL as an attachment
      filename: 'Genrated.xlsx', // File Name 
      path: 'https://raw.github.com/nodemailer/nodemailer/master/LICENSE' // Example URL
  }
  ]
};
transporter.sendMail(options , function(err,){
  if(err){
    console.log(err);
    return ;
  }
  console.log("Sent" + info.response)
})

Attach URL of Genrated Excel Sheet to be mailed in path
NOTE - Use only hotmail account at senders end , If new hotmail account use it once before using in the project

Nodemailer DOCS - https://nodemailer.com/about/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant