Meteor 流星电子邮件附件

Meteor 流星电子邮件附件,meteor,Meteor,我已经将meteor更新为1.2,现在我正尝试使用电子邮件附件功能,但不知道如何使用 《流星指南》说,请参考,但这不是很有帮助 if(true == true){ var dataAttachments = attachment; var dataText = "Client Name: " + name + "\rEmail: " + email + "\rPhone: " + phone + "\rCompany

我已经将meteor更新为1.2,现在我正尝试使用电子邮件附件功能,但不知道如何使用

《流星指南》说,请参考,但这不是很有帮助

if(true == true){
      var dataAttachments = attachment;
      var dataText = 
      "Client Name: " + name + 
      "\rEmail: " + email + 
      "\rPhone: " + phone + 
      "\rCompany: " + company +
      "\rDeliverables: " + deliverables +
      "\rCopywriting: " + copywriting +
      "\rPrint Services: " + print +
      "\rIllustration: " + illustration +
      "\rphotography: " + photography + 
      "\rTimelines: " + timelines +
      "\rBudget: " + budget +
      "\rDescription: " + description;

      Meteor.call('sendEmail', dataText, dataAttachment);
      //throwAlert is my helper method which creates popup with message
      alert('Email sent');
    }else{
      alert('An error occurred. Sorry');
      return false;
    }
  }
});


我建议安装此软件包: 然后做:

var attachments = [];
attachments.push({filename: "xxx", filePath: "xxx"});
var email = {
    from:    "test@gmail.com",
    to:      "test2@gmail.com",
    subject: "Test!",
    text:    "Text!"
    attachmentOptions: attachments
};
Meteor.call('send_one_email_with_attachments', email, function(){});


Meteor.methods({
    send_one_email_with_attachments: function(email){
        this.unblock();
        EmailAtt.send(email);
    };
});

这让我的生活在与Meteor的内置电子邮件抗争了一段时间后变得轻松了很多。它甚至可以并排工作,因此您仍然可以使用旧的非附件电子邮件功能

你到底尝试了什么,它以什么方式不起作用?你在文件名中写了什么:“xxx”代表xxx?我相信你可以在
文件名中使用你想要的任何东西,记住给它正确的扩展名。我为
文件路径使用了一个外部url;您也可以在服务器上指定一个文件。我正在尝试启用站点用户发送其附件。抱歉;你需要更具体一些。那些附件在哪里?在你的数据库里?在他们的硬盘上?在服务器上?它们是什么格式的?不过我可能帮不了你;我知道,当文件可以通过url寻址时,我的解决方案可以工作,但除此之外,我不确定。
var attachments = [];
attachments.push({filename: "xxx", filePath: "xxx"});
var email = {
    from:    "test@gmail.com",
    to:      "test2@gmail.com",
    subject: "Test!",
    text:    "Text!"
    attachmentOptions: attachments
};
Meteor.call('send_one_email_with_attachments', email, function(){});


Meteor.methods({
    send_one_email_with_attachments: function(email){
        this.unblock();
        EmailAtt.send(email);
    };
});