I am using express framework form to get inputs from user and sending it as email by using node mailer. However i am unable to receive the image and system type (Combo box).I am new to node.kindly help.
### My HTML code
```
<div class="container">
<p style="font-size:24px;">ONLINE SUPPORT REQUEST</p>
app.post('/process_post', urlencodedParser, function (req, res) {
// Prepare output in JSON format
response = {
fname:req.body.fname,
cname:req.body.cname,
email:req.body.email,
phone:req.body.phone,
emergency:req.body.emergency,
phonecall:req.body.phonecall,
systemtype:req.body.systemtype,
attachment:req.body.attachment,
supportrequest:req.body.supportrequest,
urcomments:req.body.urcomments
};
console.log(response);
res.end(JSON.stringify(response));
console.log(req.files.file.name);
console.log(req.files.file.path);
console.log(req.files.file.type);
var file = __dirname + "/" + req.files.file.name;
fs.readFile( req.files.file.path, function (err, data) {
fs.writeFile(file, data, function (err) {
if( err ){
console.log( err );
}else{
response = {
message:'File uploaded successfully',
filename:req.files.file.name
};
}
console.log( response );
res.end( JSON.stringify( response ) );
});
});
//sudan file upload edit end
//sudan edited node mailer code below
var nodemailer = require('nodemailer');
// create reusable transporter object using the default SMTP transport
// setup e-mail data with unicode symbols
var mailOptions = {
from: 'xxxxxxxx.com', // sender address
to: 'xxxxxxxxx.com', // list of receivers
subject: 'Client Support Page - Client Details', // Subject line
text: 'you have a new submission with folowwing details....Name:'+req.body.fname+'cname:'+req.body.cname+'Email:'+req.body.email+'Phone:'+req.body.phone+'emergency:'+req.body.emergency+'phonecall:'+req.body.phonecall+'systemtype:'+req.body.systemtype+'attachment:'+req.body.attachment+'supportrequest:'+req.body.supportrequest+'urcomments:'+req.body.urcomments, // plaintext body
Uploading image &combo box selection from express frame work web form and receiving it as email using nodemailer.
in JavaScript
Posted