I am trying to make a form in which users can fill out multiple fields of information that can be emailed to me. How would I do this?

Dani AI

Generated

asked how to collect form data and have it emailed. Several replies here (notably , and ) pointed toward server-side handling — that is the right direction. The simplest modern choices that run cleanly on OS X are either a tiny server endpoint you control (Node/Python/Ruby) or a hosted form service if you want zero server management.

A practical, minimal workflow:

  • keep a plain HTML form that posts to your backend endpoint (or to a hosted form endpoint),
  • the backend validates and sanitizes inputs, then hands the message to an SMTP/transactional API,
  • use environment variables for credentials, and test deliveries with a debug inbox before going live.

Example (Node + Express + Nodemailer sketch):

const express = require('express');
const nodemailer = require('nodemailer');
const app = express();

app.use(express.urlencoded({ extended: false }));

app.post('/send', async (req, res) => {
  const { name, email, message } = req.body; // validate/sanitize here
  const transporter = nodemailer.createTransport({
    host: process.env.SMTP_HOST, port: 587, auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS }
  });
  await transporter.sendMail({
    from: '"Site" <no-reply@yourdomain.com>',
    to: 'you@domain.com',
    subject: 'Form submission',
    text: `From: ${name} <${email}>\n\n${message}`
  });
  res.redirect('/thanks.html');
});

app.listen(3000);

For testing and deliverability: use a sandbox like Mailtrap during development, and a transactional provider (SendGrid/Mailgun/Postmark) in production to avoid spam filtering. If you want no server at all, a hosted endpoint such as Formspree accepts form posts and forwards mail.

Security and reliability reminders: never put SMTP credentials in client code; validate and escape all inputs; add a honeypot or CAPTCHA to limit spam; check provider logs and DNS records (SPF/DKIM) if messages land in spam. For docs and tools referenced above see Nodemailer and Mailtrap.

Recommended Answers

All 7 Replies

it's possible in ASP.NET

post ur query in ASP.NET forum

Huh? Why can't I ask my question here?

Oh yeah, I forgot to say that I'm using OS X, so ASP.net won't work for me.

hey friend
wht r u asking clearly

I am trying to make a form in which users can fill out multiple fields of information that can be emailed to me. How would I do this?

You need to post this question in another forum because it takes more than HTML to accomplish what you are trying to do.

You will need a server-side language to communicate with the mail servers.\

Post this in a PHP or ASP forum.

Why not just do a simple HTML form?

Your form code would look something like this:

<form action="/cgi-bin/formmail/yourservermailscript.pl" method="post">
<input type="hidden" name="recipient" value="youremail@domain.com">
<input type="hidden" name="subject" value="Subject of email">
<input type="hidden" name="redirect" value="yourthankyoupg.htm">
....form fields...
....form fields...
<input type="submit" name="Submit" value="Submit">
</form>

In php,it will be done by using mail function and retrieve the values by $_POST.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.