nodeschool / discussions

:school::speech_balloon: need help with nodeschool? or just wanna ask a question? open an issue on this repo!
489 stars 107 forks source link

How to receive email from contact form in my website using node.js #1646

Closed sudanvellakovilkanakavel closed 8 years ago

sudanvellakovilkanakavel commented 8 years ago

I have created a website using HTML5, and in contact page i have used java script to evaluate contact form. when client come to my website and fill their details in contact form ,of contact page and entered submit button. I like to receive an email at info@mycomopany.com.

I know that only from server side scripting we can do it. I like to do it with node.js i am new to node .js,can anyone kindly help.

My Code

`

SHOOT US AN EMAIL


```
``` ```

TheEvilDev commented 8 years ago

You don't have to do this server side necessarily, the simplest solution is a mailto link in html.

You can do this with a basic a tag:

<a href="mailto:someone@somewhere.com">Contact us!</a>

The advantages of this approach, is simplicity, and it opens the user's configured email client, which may be more comfortable for them to use, and they get a copy of the feedback they submit automatically in their sent mail box.

If you want your send to address to remain annonomous, then you will need to do this server side. There are a number of tools in node to do this, including https://nodemailer.com/.

That said, any library supporting the protocol of your mailserver can do this (i.e. pop, imap, exchange, etc). The main advantage of this approach is you protect your inbox from spam, and you can add additional verification on your site (like a captcha).

sudanvellakovilkanakavel commented 8 years ago

Hi, Thank you for the replay.It was very useful.I have little doubts.

1)mailto option doesn't take content (form fields) client has filled in the form and send it as e-mail to someone@somewhere.com

2)I am looking for noide.js function which is equivalent to mail() function in php

3)Nodemailer is used for sending multiple mails from our website(newsletters,email marketing etc)

4) I am looking for client who visit my webpage,if he like to contact me ,he should fill a form and click submit,which i will receive in mail.

kindly correct me,if i am wrong.

TheEvilDev commented 8 years ago

Hey,

I'm not aware of any mail function in vanilla node, you're likely going to need a package for that. Nodemailer can be used for mass email, but there's really not much difference between sending 1 or 100 emails, you just need a straight forward abstraction layer over the smtp server.

Here's a blog post that show's the basic essentials: http://javascript.tutorialhorizon.com/2015/07/02/send-email-node-js-express/

A quick google search aslo turns up node-sendmail: https://www.npmjs.com/package/sendmail

Give the example a try and see if it works for you.

sudanvellakovilkanakavel commented 8 years ago

Hi nodemailer package worked successfully for my contact form. I used both sender and receiver mail id as same. so when client fill his details in my contact form in contact page and click submit,mail containing details of the form filled by client is send from my mail id to same id.

Thus i got the details of the clients who fill my contact form. Your guidance was very useful,thank you very much.

arezonasehi commented 6 years ago

hey , would you please send me your code on nasehi.amir@gmail.com , cause i have the same issue , and you've already solved it,

mizaelmorales commented 6 years ago

please send me the code mizael754@gmail.com i need help with this one

deepakparamesh commented 6 years ago

Hi, I think this video would help for nodejs developers. https://www.youtube.com/watch?v=nF9g1825mwk

dark-dao commented 6 years ago

Here is my simple implementation https://github.com/dark-dao/feedback-service. Run this service on your server. Then send a request from the web page. Then the data is sent by email using nodemailer. You can modify it to your needs))

Kirti003Shukla commented 4 years ago

Please share its code at kirti003shukla@gmail.com, I am facing the same issue. I have installed nodemailer but still, I am not able to get form details, it is showing reference error for node mailer. Thanks in advance

vishalisakar commented 3 years ago

Hi @sudanvellakovilkanakavel, I am also facing the same issue, would You please share your code to vishalisakar27@gmail.com. Thank you in advance.

Kirti003Shukla commented 3 years ago

Hi, I solved the problem through php and jQuery, if you want that I can share.

On Thu 21 Jan, 2021, 7:06 PM Vishali Sakar, notifications@github.com wrote:

Hi @sudanvellakovilkanakavel https://github.com/sudanvellakovilkanakavel, I am also facing the same issue, would You please share your code to vishalisakar27@gmail.com. Thank you in advance.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nodeschool/discussions/issues/1646#issuecomment-764646986, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMPRIII4ETHB2LY4MWSYSR3S3AUW5ANCNFSM4B4FOUNQ .

vishalisakar commented 3 years ago

Thank you @Kirti003Shukla , but I am looking up in javascript node js.

NJBOOT commented 3 years ago

Look up the nodemailer package on npm and read the documentation

Sent from my iPhone

On Jan 21, 2021, at 8:53 AM, Vishali Sakar notifications@github.com wrote:

 Thank you @Kirti003Shukla , but I am looking up in javascript node js.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.