简体   繁体   English

如何在meteor.js中创建与我们联系表格

[英]how to create contact us form in meteor.js

I made a contact us form and having problem that how a user submitted details will be delivered to my email. 我做了一个联系我们表格,但有一个问题,用户如何提交详细信息将发送到我的电子邮件中。 I am newbie and do not understand this from Meteor Docs "the MAIL_URL environment variable should be of the form smtp://USERNAME:PASSWORD@HOST:PORT/ " I want to deploy my meteor app on Meteor free server so please guide me how i should write the above URL thing in serevr/smpt You can have look at my source code client/templates/contact_us/contact_us.html and contact_us.js and server/common.js and can tell me if my rest of code is also correct to perform the contact us form functionality. 我是新手,不了解Meteor Docs的问题, “ MAIL_URL环境变量的格式应为smtp:// USERNAME:PASSWORD @ HOST:PORT /”,我想在Meteor免费服务器上部署我的Meteor应用程序,所以请指导我我应该在serevr / smpt中写上面的URL内容您可以看一下我的源代码 client / templates / contact_us / contact_us.htmlcontact_us.jsserver / common.js,并可以告诉我我的其余代码是否正确执行与我们联系表单功能。

You should create an account on Mailgun (default by Meteor). 您应该在Mailgun上创建一个帐户(Meteor默认)。

Let's say you use your gmail account which is waquar@gmail.com and your password is pass123: 假设您使用的gmail帐户为waquar@gmail.com,密码为pass123:

Meteor.startup(function() {
    process.env.MAIL_URL = 'smtp://waquar:pass123@smtp.gmail.com:587/'
});

Both your server method and client code seem to be correct, try steps above and let us know if it works. 您的服务器方法和客户端代码似乎都是正确的,请尝试上述步骤,并让我们知道它是否有效。

I have in my ~/.bashrc of my dev environment something like: 我的开发环境中的〜/ .bashrc中有以下内容:

export MAIL_URL='smtp://myemail%40example.com:mypass@mysmtpserver.com:587/'

You can test with a server.js like: 您可以使用server.js进行测试,例如:

Email.send({
  from: "meteor.email.2014@example.com",
  to: "your-personal-email-here@example.com",
  subject: "Meteor Can Send Emails",
  text: "Its pretty easy to send emails."
});

as described in https://github.com/nelsonic/hapi-email for gmail. https://github.com/nelsonic/hapi-email中针对gmail所述。 After receiving the test email, you can remove that file. 收到测试电子邮件后,您可以删除该文件。

In production I use mup with the save env variable. 在生产中,我将mup与save env变量一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM