Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!