HI i know this is probably a novice question but i made a form just with name and email and a comments box but i am having trouble with my submit button, is there a way that i can just have it send the form information to me in an email when the form is submitted, instead of it being sent to a database? I really appreciate the help.

Thanks

R

Dani AI

Generated

Short practical answer: have the form POST to a server-side handler that validates input and sends mail through an authenticated SMTP relay for reliable delivery. Hosted form services (as suggested by ) or packaged scripts (as mentioned by ) are quick options; the idea of server-side mailing (not a mailto: link) was touched on by — the following clarifies the common pitfalls and a safe workflow.

Minimal workflow to implement:

  • Use a form with method="post" action="contact-handler.php".
  • In the handler validate and sanitize every field and validate the email address server-side.
  • Prevent header injection by stripping CR/LF characters from any header-related input.
  • Set a fixed From address on the server (a domain-owned address) and put the visitor’s address in Reply-To.
  • Send via authenticated SMTP (PHPMailer, SwiftMailer, or a hosted SMTP provider) rather than relying on unsecured local delivery for better deliverability.

Security, deliverability and testing notes:

  • Add spam protections (captcha or honeypot), CSRF tokens, and rate limiting.
  • Configure SPF/DKIM/DMARC on the sending domain so messages aren’t flagged as spoofing.
  • Local development environments often lack a mail agent; test with an SMTP test inbox or a dedicated testing service and review server mail logs or the mail queue if delivery fails.
  • Many shared hosts block raw outbound mail/port 25; authenticated SMTP with TLS and login is more portable and reliable.

For beginners, a hosted form provider is the fastest path. For production-grade contact forms, an authenticated SMTP solution plus input validation and DNS mail records is the safest, most reliable approach.

Recommended Answers

All 3 Replies

Or you could use a free form creator like emailmeform.com. They have a pretty good free form host that lets you edit the form to your likings and secures it with a captcha.

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.