电子邮件地址是流星 js 中活动监视器 api 的无效响应
Email address is invalid response from campaign monitor api in meteor js
我在 meteor project. I am trying to add a email address to a subscriber list using the campaign monitor api. I am using a npm package called createsend-node 中遇到问题,它是 api 的包装器。我已经使用 api 成功地将订阅者添加到列表中,但是当我尝试从表单提交事件中触发流星服务器方法时,api 会返回 email address not valid response code 1
。我将在下面包含我的代码。当我在没有方法的情况下手动添加订阅者时,它是成功的。邮箱地址我手动传的时候是一个字符串,方法也是一样的。代码如下。
html
<template name="info">
<h2>Signup For Our Newsletter</h2>
<form id="cm-subscribe">
<input field name="email" type="email" value="email">
<input field name="name" type="text" value="name">
<input type="submit">
</form>
</template>
客户端js
Template.info.events({
'submit #cm-subscribe'(event){
event.preventDefault();
var form = event.target;
var email = form.email.value;
var name = form.name.value;
console.log(email + " / " + name);
Meteor.call('addSub', email, name);
}
});
服务器端 js
Meteor.methods({
addSub: function (name, email) {
console.log(name);
console.log(email);
var listId = 'someid' // The ID of the list
var details = {
EmailAddress: email,
Name: name,
CustomFields: [
{ Key: 'CustomKey', Value: 'Some Value' }
]
};
api.subscribers.addSubscriber(listId, details, (err, res) => {
if (err) console.log(err);
});
}
});
你颠倒了调用者和方法之间的参数。
Meteor.call('addSub', email, name)
Meteor.methods({
addSub: function (name, email) {
我在 meteor project. I am trying to add a email address to a subscriber list using the campaign monitor api. I am using a npm package called createsend-node 中遇到问题,它是 api 的包装器。我已经使用 api 成功地将订阅者添加到列表中,但是当我尝试从表单提交事件中触发流星服务器方法时,api 会返回 email address not valid response code 1
。我将在下面包含我的代码。当我在没有方法的情况下手动添加订阅者时,它是成功的。邮箱地址我手动传的时候是一个字符串,方法也是一样的。代码如下。
html
<template name="info">
<h2>Signup For Our Newsletter</h2>
<form id="cm-subscribe">
<input field name="email" type="email" value="email">
<input field name="name" type="text" value="name">
<input type="submit">
</form>
</template>
客户端js
Template.info.events({
'submit #cm-subscribe'(event){
event.preventDefault();
var form = event.target;
var email = form.email.value;
var name = form.name.value;
console.log(email + " / " + name);
Meteor.call('addSub', email, name);
}
});
服务器端 js
Meteor.methods({
addSub: function (name, email) {
console.log(name);
console.log(email);
var listId = 'someid' // The ID of the list
var details = {
EmailAddress: email,
Name: name,
CustomFields: [
{ Key: 'CustomKey', Value: 'Some Value' }
]
};
api.subscribers.addSubscriber(listId, details, (err, res) => {
if (err) console.log(err);
});
}
});
你颠倒了调用者和方法之间的参数。
Meteor.call('addSub', email, name)
Meteor.methods({
addSub: function (name, email) {