2017-09-20 2 views
0

이 Meteor 서버 코드는 pdf 파일을 첨부하려고 시도하지만 서버 시작시 오류가 발생합니다. 먼저 파일을 로컬에 저장하지 마십시오. 그것은 pascoual : pdfkit을 사용하고 있습니다. mailcomposer documentationmeteor에있는 이메일에 pdf를 첨부하십시오.

Error: Message failed: 421 Timeout waiting for data from client.

유성 문서 포인트,하지만 문제는 첨부 파일에서 PDF의 문서를 통합하는 방법입니다 :
나는 점점 오전 오류입니다. 어떤 아이디어? 나는 Invoice.make()이 덩어리의 형식을 기대 반환하지 않습니다 잘못 아니에요 경우 덕분에 문서 당으로

Meteor.startup(() => { 
    Invoice.email(); 
}; 

// invoice.js 
use strict"; 
let PDFDocument = require ('pdfkit'); 
let metaData = { 
    'Title': 'Invoice', 
    'Author': 'myName', 
}; 
export const Invoice = { 
    'make': function() { 
    let doc = new PDFDocument(metaData); 
    doc.text('my company').text('company number'); 

    return doc; 
    }, 
    'email': function() { 
    let inv = Invoice.make(); 
    Email.send({ 
     to: '[email protected]', 
     from: '[email protected]', 
     subject: 'Invoice', 
     text: ' Please see the attached invoice', 
     attachments: { 
     filename: 'invoice.pdf', 
     content: inv // <=== this is the issue 
    }); 
    } 
}; 

답변

0

content 정의는

content - String, Buffer or a Stream contents for the attachment

링크

mailcomposer documentation.이다. 친절하게 스트림을 확인하고 입력하면 입력하는 것을 얻을 수 있습니다.

Supporting details

관련 문제