I am creating the the web app that send mail through nodejs . however when user click on send button the message get send as a mail to another user. But it is send as with username and pass(mail-id) as per the in auth section in nodemailer configuration. I want to send html with form/data and button so that when reciver click on its gets redirect to another page and must be able to access its gmail-id and some data/form values in that page so that i can create reply form .
var mail = nodemailer.createTransport({
service: 'gmail',
auth: {
user:'example@gmail.com',
pass: process.env.mail_server
}
});
var mailOptions = {
from: userSending@gmail.Email,
to: userReciving@gmail.Email,
subject: data.subject,
html:`<div><p> message ${data}</p></div>
<form action="/path" method="post">
<button type="button" name="send" value="send" >Send</button>
</form>`
};
mail.sendMail(mailOptions, function(error, info){
console.log("running")
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
NOTE :1) here i must be able to use "data " define in html of nodemailer and 2) gmail of one when click on send button
Note:please mention another approach if you find .