in lambda/Message_Archiver/archiver/lib/archiver.js [73:111]
generateMimeBody(rendered, endpointId, config) {
const msg = mimemessage.factory({
contentType: 'multipart/mixed',
body: []
});
// Add Mime Headers
msg.header('EndpointId', endpointId);
msg.header('ApplicationId', config.applicationId);
msg.header('EventTimestamp', config.eventTimestamp);
if (config.campaignId) {
msg.header('CampaignId', config.campaignId);
msg.header('TreatmentId', config.treatmentId);
} else if (config.journeyId) {
msg.header('JourneyId', config.journeyId);
msg.header('JourneyActivityId', config.journeyActivityId);
}
msg.header('Channel', rendered[0].channel);
// const title = rendered.find(x => x.pieceType === 'TITLE');
// if (title) {
// msg.header('Subject_Title', title.html);
// }
// rendered.filter(x => x.pieceType !== 'TITLE').forEach((rendering) => {
rendered.forEach((rendering) => {
const piece = mimemessage.factory({
contentType: 'multipart/mixed',
body: rendering.html
});
piece.header('Content-Piece-Type', rendering.pieceType);
msg.body.push(piece);
});
return msg.toString();
}