gpt4 book ai didi

email - 使用mailGun在Meteor应用程序中发送电子邮件-调用方法 'sendEmail'出错

转载 作者:行者123 更新时间:2023-12-02 11:03:30 25 4
gpt4 key购买 nike

我使用Meteor v1构建应用程序,并且为了能够从我的应用程序发送电子邮件,我添加了电子邮件包。
这是我在客户端上的代码

Template.Home.events({
'click button': function(event, template){
event.preventDefault();


var depart = template.find('[id=exampleInputEmail1]').value;
var arrive = template.find('[id=exampleInputPassword1]').value;
var email = template.find('[id=exampleInputPassword1m]').value;
var nom = template.find('[id=exampleInputPassword1s]').value;
var telephone = template.find('[id=exampleInputPassword1n]').value;
var element = template.find('[id=exampleInputPassword1j]').value;



Meteor.call('sendEmail', 'nwabdou85@yahoo.fr', email, 'Faites moi un devis rapide svp', 'This is a test of Email.send.');

}

});

服务器之一是
Meteor.startup(function() {
var username = "postmaster%40sandboxxxxxxxx.mailgun.org";
var password = "xxxxxxxxxxx";
var server = "smtp.mailgun.org";
var port = "587"

process.env.MAIL_URL = 'smtp://' + encodeURIComponent(username) + ':' + encodeURIComponent(password) + '@' + encodeURIComponent(server) + ':' + port;
});
// In your server code: define a method that the client can call
Meteor.methods({
'sendEmail': function (to, from, subject, text) {
// check([to, from, subject, text], [String]);
this.unblock();

Email.send({
to: to,
from: from,
subject: subject,
text: text
});
}
});

但它不起作用!它在consol上抛出此错误:调用方法'sendEmail'时出错:内部服务器错误[500]

您甚至可以遇到这个问题吗?您能解决这个问题吗?

最佳答案

我建议将您的主机切换到Heroku,这是免费的,但可配置性更高。尝试阅读我最近关于该主题的文章,应该会给您一些提示:http://joshowens.me/modulus-vs-heroku-vs-digital-ocean/

关于email - 使用mailGun在Meteor应用程序中发送电子邮件-调用方法 'sendEmail'出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27198349/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com