MCPcopy Create free account
hub / github.com/totaljs/framework / writeattachemnt_stream

Function writeattachemnt_stream

mail.js:474–504  ·  view source on GitHub ↗
(attachment, obj, stream)

Source from the content-addressed store, hash-verified

472};
473
474function writeattachemnt_stream(attachment, obj, stream) {
475
476 var name = attachment.name;
477 var isCalendar = attachment.extension === 'ics';
478 var message = [];
479
480 message.push('--' + obj.boundary);
481
482 if (!isCalendar) {
483 if (attachment.contentId) {
484 message.push('Content-Disposition: inline; filename="' + name + '"');
485 message.push('Content-ID: <' + attachment.contentId + '>');
486 } else
487 message.push('Content-Disposition: attachment; filename="' + name + '"');
488 }
489
490 message.push('Content-Type: ' + attachment.type + ';' + (isCalendar ? ' charset="utf-8"; method=REQUEST' : ''));
491 message.push('Content-Transfer-Encoding: base64');
492 message.push(CRLF);
493 mailer.$writeline(obj, message.join(CRLF));
494
495 stream.$mailer = mailer;
496 stream.$mailerobj = obj;
497 stream.on('data', writeattachment_data);
498
499 CLEANUP(stream, function() {
500 mailer.$writeline(obj, CRLF);
501 mailer.$writeattachment(obj);
502 });
503
504}
505
506function writeattachment_data(chunk) {
507

Callers 1

mail.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected