【问题标题】:Configure Mandrill with Meteor fail使用 Meteor 配置 Mandrill 失败
【发布时间】:2016-01-09 22:25:24
【问题描述】:
我总是收到错误提示:
TypeError: 无法调用未定义的方法 'config'。
这是我在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"
});
});
【问题讨论】:
标签:
javascript
email
meteor
mandrill
【解决方案1】:
meteor 启动函数不是为了返回某些东西而设计的,这是你的第一个错误。
另一方面,我可以在their documentation 上看到您必须直接配置对象 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, ...
});
}