Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

144
Visualizações
How do i get fieldvalues in the Body of a javascript generated email

i can produce an email with javascript and smtp.js.

I would however like to add fieldvalues from the form into the body and cannot find the right syntax.

there is an inputfield for email and a field for a number, i tried : var email=Form.email.value; var body = " Well that was easy!! "+email;

Subject: "Sending Email using javascript", Body: "here i would like to add fieldvalues", })

Can anyone please give a hint, i do not use javascript very often. Seems i will have to start learning. . .

Regards, Jan

Here is the code i used:

<!DOCTYPE html>
<html>
  
<head>
  <title>Send Mail</title>
  <script src=
    "https://smtpjs.com/v3/smtp.js">
  </script>
  
  <script type="text/javascript">
    function sendEmail() {
      Email.send({
        Host: "smtp.gmail.com",
        Username: "sender@email_address.com",
        Password: "Enter your password",
        To: 'receiver@email_address.com',
        From: "sender@email_address.com",
        Subject: "Sending Email using javascript",
        Body: "Well that was easy!!",
      })
        .then(function (message) {
          alert("mail sent successfully")
        });
    }
  </script>
</head>
  
<body>
  <form method="post">
<!-- here i would like to enter an e-mail-address that i want to use in the e-mail that is sent -->
    
    E-Mail: <input class="input2" type="text" name="email"><br>
    
    <input type="button" value="Send Email" 
        onclick="sendEmail()" />
  </form>
</body>
  
</html>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I mixed up var and let.

so far it is sending an email and i can enter some text from the inputfield with:

let email = document.getElementById("email").value;

Now i need to get an array in property "To" so i can sand to 2 email-addresses.

regards,
Jan

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda