I am writing a node.js program that stores incoming email in a database but I am having issues getting the email body. I am using the inbox module. I am also using an outlook account.
var inbox = require("inbox");
//I have left out the auth part of the code as it is working correctly.
client.connect();
client.on("connect", function(){
console.log("Connected!");
client.openMailbox("GCJA", function(err, messages){
if(err) throw error;
client.on("new", function(message){
console.log("New incoming message " + message.title);
var messageID = message.UID;
// get the body of an email
var messageBody = client.createMessageStream(messageID);
console.log("[][RAW MESSAGE START][]"+ messageBody + "{}{RAW MESSAGE END}{}");
//returnes [Object Object]
When I run the program, there are no errors, however it does not return the body of the email but instead [Object Object]. I want to save only the plaintext email in a varible in a form that any human could read and understand.