Hello
I need to make a simple contact form, just to get from a client that is interested
His name, massage and email.
Please i need your help !
I have been trying for days now.
I get the email, but i dont get the massage and input fields to get save.
Thank you very much !!
client.coffee
Template.contact_materialize.events = 'submit #contact_materialize': (event, template) ->
firstname = contact_materialize.find('#firstname').value
lastname = contact_materialize.find('#lastname').value
email = contact_materialize.find('#email').value
message = contact_materialize.find('#message').value
return
Meteor.call 'sendEmail', 'my@live.com', 'bob@example.com', 'Hello from Meteor!', 'This is a test of Email.send.'
server.js
Meteor.methods({
sendEmail: function (to,subj,text) {
check([text], [String]);
this.unblock();
Email.send({
to: 'my@live.com',
from: 'no-replay@mydomain.com',
subject: 'New message from contact form',
text: text
});
}
});
Meteor.startup(function () {
// AWS emailing
process.env.MAIL_URL = 'smtp://postmaster%40sandbox.mailgun.org:@smtp.mailgun.org:25 ';
(I have deleted here some of the code, this part works)
});
contact.jade
template(name="contact_materialize")
main
#index-banner.section.no-pad-bot
.container
br
h1.header.center Contact
br
.row
form#contact_materialize.col.s12
.row
.input-field.col.s6
input#firstName.validate(type="text", name="firstName")
label(for="first_name") First Name
.input-field.col.s6
input#lastName.validate(type="text", name="lastName")
label(for="last_name") Last Name
.row
.input-field.col.s12
input#email.validate(type="email", name="email")
label(for="email") Email
.row
form.col.s12
.row
.input-field.col.s12
textarea#message.materialize-textarea
label(for="message") Your Message
button.btn.waves-effect.waves-light(type="submit", value="Send", name="action")
| Submit
i.mdi-content-send.right