Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda