/** * Responds to any HTTP request. * * @param {!express:Request} req HTTP request context. * @param {!express:Response} res HTTP response context. */ exports.receiveParsingEmail = (req, res) => { var http = require("https"); console.log("Cloud Function Start : " + req.body.toString());
let apikey = process.env.apikey; let fromaddr = process.env.fromaddr; let fromname = process.env.fromname; let toaddr = process.env.toaddr; let toname = process.env.toname; // let mailcontent = req.body.toString();
console.log("Mail to addr=" + req.body.toString());
var mailreq = http.request(options, function (mailres) { var chunks = []; mailres.on("data", function (chunk) { chunks.push(chunk); }); mailres.on("end", function () { var body = Buffer.concat(chunks); console.log(body.toString()); }); });
const busboy = newBusboy({ headers: req.headers }); const fields = {}; // This code will process each non-file field in the form. busboy.on('field', (fieldname, val) => { console.log(`Processed field ${fieldname}: ${val}.`); fields[fieldname] = val; });