Pick up information from the form and send it to email

0

I have a form that I will have to get the information typed and send to my email via java script or jquery but I do not know how to do this until the moment I just validated my form follows the code of my form:

.corpo-1 ul li {

  display: block;

  margin: 10px;

  text-align: center;

}

.corpo-1 ul {

  margin-top: 10%;

}

.contato-barra {

  width: 10%;

  height: 2px;

  background-color: #000;

  border: none;

}

input[type="text"] {

  border: 1px solid #000;

  border-radius: 5px;

  width: 300px;

  height: 25px;

  background-color: transparent;

  font-family: Gabriola;

  font-size: 1.2em;

  outline: none;

}

.teste1 {

  margin-left: 65%;

  background-color: aquamarine;

  width: 100px;

  height: 50px;

  color: #000;

  display: none;

}

select {

  border: 1px solid #000;

  border-radius: 5px;

  width: 300px;

  height: 40px;

  background-color: transparent;

  font-family: Gabriola;

  font-size: 1.2em;

  outline: none;

}

textarea {

  border: 1px solid #000;

  border-radius: 5px;

  width: 300px;

  height: 100px;

  background-color: transparent;

  font-family: Gabriola;

  font-size: 1.2em;

  outline: none;

}

#enviar {

  background-color: #000;

  width: 300px;

  height: 50px;

  border: none;

  border-radius: 5px;

  color: #fff;

  font-family: Gabriola;

  font-size: 1.3em;

  text-align: center;

  cursor: pointer;

  outline: none;

}

#enviar:hover {

  background-color: #333;

}

#bg-fundo {

  position: absolute;

  z-index: -1;

  opacity: 0.25;

  left: 0;

  right: 0;

  margin: auto;

  margin-top: -18%;

  /*width: 50%;*/

  transform: scale(1);

}
<section class="corpo-1">
  <div id="formulario">
    <form method="post" action="">
      <ul>
        <li>
          <input type="text" id="nome" placeholder="  Digite seu nome" required name=nome>
        </li>
        <li>
          <input type="text" placeholder="  Digite seu Email" required name=email>
        </li>
        <li>
          <input type="text" placeholder="  Digite seu Nickname" required name=nickname>
        </li>
        <li>
          <select>
            <option value="the-elder" selected>--- Selecione um jogo ---</option>
            <option value="the-elder">The Elder Scrols Online</option>
            <option value="archage">ArcheAge</option>
            <option value="worlofwarcraft">World of War Craft</option>
            <option value="forsaken">Forsaken World</option>
            <option value="leagueoflegends">League of Legends</option>
            <option value="dota">Dota 2</option>
            <option value="smite">Smite</option>
            <option value="warface">Warface</option>
            <option value="cs">CS-GO</option>
            <option value="bf">Battle Field</option>
            <option value="cod">Call of Dutty</option>
          </select>
        </li>
        <li>
          <textarea placeholder="  Mensagem" required name=mensagem></textarea>
        </li>
        <li>
          <input type=submit value="Enviar" id="enviar" />
        </li>
      </ul>
    </form>
  </div>
</section>

Note: My email will be sent to mine in the case [email protected]

    
asked by anonymous 27.05.2015 / 16:30

2 answers

3

You can not send mail using only JavaScript. You should use a server language for this, for example PHP.

But you can use the window.open('mailto:[email protected]'); command to open the default email program and send the email.

You can also pass parameters in the command: window.open('mailto:[email protected]?subject=assunto&body=corpo');

Example in PHP:

<?php
$para       = '[email protected]';
$assunto    = 'Algum Assunto';
$mensagem   = 'Olá';
$cabecalhos = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($para, $assunto, $mensagem, $cabecalhos);
?>
    
27.05.2015 / 16:34
1

You really have to use a language on the server to send your email. PHP is very good at this, read here a very complete article on how to do this.

There is also PHPMailer, here another article explaining about it.

    
27.05.2015 / 16:40