使用Meteor配置Mandrill失败



我总是得到错误说:

TypeError: Cannot call method 'config' of undefined.

这是我在server.js的启动函数。我做错了什么?

Meteor.startup(function() {
	return Meteor.Mandrill.config({
	  username: "SMTP Username",
	  key: "Valid API Key",
	  password: "Valid API Key",
	  port: "587",
	  host:"smtp.mandrillapp.com"
	});
});

流星启动函数不是为了返回一些东西而设计的,这是你的第一个错误。
另一方面,我可以从他们的文档中看到,你必须直接配置对象Mandrill。

if (Meteor.isServer) {
    // server code
    Mandrill.config({
          username: "SMTP Username",
          key: "Valid API Key",
          password: "Valid API Key",
          port: "587",
          host:"smtp.mandrillapp.com"
        // baseUrl: 'https://mandrillapp.com/api/1.0/'  // update this in case Mandrill changes its API endpoint URL or version
    });
    // you can put a Meteor startup here if you want : 
    Meteor.startup(function() {
        // Do somthing else, like populating, ...
    });
}

最新更新