How do I create a javascript to send a form to my email?

Asked

Viewed 2,576 times

0

I contain the following HTML5 code:

<div class="form">

                    <div id="sendmessage">Sua mensagem foi enviada. Obrigado!</div>
                    <div id="errormessage"></div>
                    <form action="" method="post" role="form" class="contactForm" id="contactForm">
                        <div class="form-group">
                            <input type="text" name="name" class="form-control input-text" id="name" placeholder="Seu nome" data-rule="minlen:4" data-msg="Introduza pelo menos 4 caracteres" />
                            <div class="validation"></div>
                        </div>
                        <div class="form-group">
                            <input type="email" class="form-control input-text" name="email" id="email" placeholder="Seu email" data-rule="email" data-msg="Por favor digite um email válido" />
                            <div class="validation"></div>
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control input-text" name="subject" id="subject" placeholder="Assunto" data-rule="minlen:4" data-msg="Introduza pelo menos 8 caracteres do assunto" />
                            <div class="validation"></div>
                        </div>
                        <div class="form-group">
                            <textarea class="form-control input-text text-area" name="message" rows="5" data-rule="required" data-msg="Por favor, escreva algo para nós" placeholder="Mensagem"></textarea>
                            <div class="validation"></div>
                        </div>

                        <div class="text-center"><button type="submit" class="input-btn">Enviar Mensagem</button></div>
                    </form>
                </div>  

How to add a javascript to send me this information, and appear the messages indicated there?

2 answers

1

If you only want to receive this form in your Email, I recommend this ridiculously simple tool. https://formspree.io/

<form action="https://formspree.io/**seuemail**" method="POST"> <input type="text" name="name"> <input type="email" name="_replyto"> <input type="submit" value="Send"> </form>

0

To send by javascript you can use smtpjs (http://www.smtpjs.com/). On the site itself has the example of how to use and watch out for the security part that they have a tool to generate a token instead of you put your credentials openly in the code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.