Meteor.js email.send 在尝试发送给用户数组时不起作用
meteor.js email.send not working when trying to send to array of users
所以我的email.send可以工作,但前提是我只向一个用户发送电子邮件。下面是 meteor.Method 中的代码:
sendEmail: function (to, from, subject, text) {
check([to, from, subject, text], [String]);
this.unblock();
Email.send({
to: to,
from: from,
subject: subject,
text: text
});
}
}(;
工作客户端代码:
Meteor.call('sendEmail',
'yechielxxx@gmail.com',
'boazxxx@gmail.com',
'test',
'testing meteor email');
不工作:
Meteor.call('sendEmail',
['yechielxxx@gmail.com','boazxxx@gmail.com','boazxxx@walla.co.il'],
'boazxxx@gmail.com',
'test',
'testing meteor email');
我在这里错过了什么?这就是docs.meteor所说的"字符串或字符串数组"RFC5322 "收件人:"地址[es]">
IM 使用一系列用户,一切都应该工作正常。
我在v0.6.5.1
上对此进行了测试,Email.send
将采用一个数组,但您的代码没有运行,因为当您传递数组时检查将失败to
.如前所述,它正在寻找所有输入都是字符串。如果将其修改为以下内容:
check(to, Match.OneOf(String, [String]));
check([from, subject, text], [String]);
然后你可以将字符串或数组传递给sendEmail
它应该可以工作。
相关文章:
- 使用javascript搜索具有用户输入的数组
- 将JavaScript数组传递给函数
- 将当前用户的 ID 推送到 meteorjs 中集合/文档的内部数组
- 如何在用户输入时实例化数组
- 如何从客户端的数组中获取用户输入和返回值
- 将数组的拼接分配给自身时,Javascript控制台打印不起作用
- 角度推入数组给出:TypeError:无法读取属性'推'的未定义
- Javascript:使用用户输入搜索数组
- 从一个数组中查找一个属性的最大值,并将其传递给新数组
- AngularJS:如何给值数组过滤
- 不能给类型化数组缓冲区赋值
- 如何将数组传递给用户定义的对象或将非OO代码转换为OO?javascript
- 将php数组赋值给javascript数组
- 将asp.net c#变量赋值给javascript数组
- 将JS数组传递给新数组
- 如何将PHP数组赋值给jQuery数组
- 给我数组中所有具有相同日期的元素,JS
- 如何在JavaScript中委托给对象数组
- 将不可变列表传递给需要数组的组件
- 将php数组中的值赋给javascript数组