尝试使用mailgun发送电子邮件时获得“类型错误:未定义不是一个函数”
Getting "TypeError: undefined is not a function" when trying to send email using mailgun
我正在尝试使用mailgun发送电子邮件,我在下面给出了我的代码
Parse.Cloud.define("SendEmail", function(request, response) {
var Mailgun = require('mailgun');
Mailgun.initialize('domainName', 'myApikey');
Mailgun.sendEmail({
to: "test@test.com" ,
from: "test@test.com",
subject: "Title",
text: "Contents"
},{
success: function() {
response.success(request.params);
console.log("--email sent - success");
console.log(request.params);
},
error: function() {
console.log("--failed to send email - success");
console.error(request.params);
response.error("Uh oh, something went wrong");
}
});
});
但是在行Parse.Cloud.define("SendEmail", function(request, response)
中收到错误TypeError: undefined is not a function
并且没有发送电子邮件,我是mailgun和parse的新手,请协助我,提前谢谢
我在自己的 CloudCode 实例中运行了您的代码,它执行得很好。你能发布你的整个主文件吗.js请问?可能存在格式问题或类似问题。
相关文章:
- Javascript未捕获类型错误:无法读取属性'0'的未定义
- 使用Google Analytics API的区域图-未采集类型错误无法读取'库'的未定义
- vendors.js:未捕获类型错误:无法读取属性'应用'使用webpack时未定义的
- 未捕获类型错误:无法设置未定义的属性“操作”
- 反应.js:未捕获类型错误:未定义不是一个函数
- 如何处理 getJSON 调用上的“未捕获类型错误:无法设置未定义的属性'prop'”
- 正在尝试滚动页面:未捕获类型错误:无法读取属性'top'的未定义
- 谷歌URL缩短器API-未压缩类型错误:未定义不是一个函数
- 滚动字幕未捕获类型错误:无法读取属性'style'的未定义
- 无法解释的未捕获类型错误:未定义不是函数
- Jquery json:未捕获类型错误:无法读取属性'xx'的未定义
- JSON JQUERY未捕获类型错误:无法读取属性'长度'的未定义
- 模板抛出-未捕获类型错误:无法调用方法'匹配'的未定义
- Highcharts未捕获类型错误:无法设置属性'第'天;的未定义
- 树映射导致未捕获类型错误:未定义不是函数
- 未捕获类型错误的coffescription:无法读取属性'offsetWidth'的未定义错误
- Firebug:未捕获类型错误:未定义不是函数
- Kendo ui:未捕获类型错误:无法读取属性'至小写'的未定义
- 离子模态未打开(类型错误:无法读取未定义的属性“显示”)
- 在chrome中无法读取未定义类型错误的属性套接字.套接字API