angularjs - Getting the subject line in gmail api - javascript -
i'm trying subject line email using gmail api. have email , tried following documentation. array of headers place holder subject line different in each email.
how can subject header back?
right i'm specifying element in array so:
var parsed5 = resp.payload.headers[1].name;
however don't want have specify element of area, there way right stuff based on header name instead of element?
you can find subject :
for (var headerindex = 0; headerindex < resp.payload.headers.length; headerindex++) { if (resp.payload.headers[headerindex].name == 'subject') { relatemaildetail.openmailsubject = msg.payload.headers[headerindex].value; } if (resp.payload.headers[headerindex].name == 'from') { relatemaildetail.from = msg.payload.headers[headerindex].value; } if (resp.payload.headers[headerindex].name == 'date') { relatemaildetail.recievedate = msg.payload.headers[headerindex].value; } if (resp.payload.headers[headerindex].name == 'to') { relatemaildetail.to = msg.payload.headers[headerindex].value; } if (resp.payload.headers[headerindex].name == 'cc') { relatemaildetail.cc = msg.payload.headers[headerindex].value; } if (resp.payload.headers[headerindex].name == 'reply-to') { relatemaildetail.replyto = msg.payload.headers[headerindex].value; } }
Comments
Post a Comment