Hello i'm not recieving any emails on my website. Can someone help me? Thank you.

            <div class="col-sm-6 col-md-8">
                <form action="#" method="post" role="form">
                    <div class="col-md-6">
                        <input type="text" class="form-control" placeholder="Name">
                    </div>
                    <div class="col-md-6">
                        <input type="email" class="form-control" placeholder="Email">
                    </div>
                    <div class="col-md-12">
                        <input type="text" class="form-control" placeholder="Subject">
                    </div>
                    <div class="col-md-12">
                        <textarea class="form-control" rows="6" placeholder="Message"></textarea>
                    </div>
                    <div class="col-md-12">
                        <input type="submit" value="SEND MESSAGE" class="form-control">
                    </div>

Dani AI

Generated

The HTML in the first post builds the UI only; it will not send email by itself. As pointed out, a server-side mail handler is required. Also, the form inputs shown have no name attributes, so a backend will not receive any field values even if the form is submitted.

Minimum checklist to get the form working:

  • Add name attributes to each control (for example name="name", name="email", name="subject", name="message"). Server code relies on those keys.
  • Point the form action at a processing endpoint (for example contact-handler.php) and keep method="post".
  • Server-side processing must: validate and sanitize inputs, reject invalid emails, guard against header-injection, and then send the mail.
  • Use an authenticated SMTP pathway or a transactional email service for reliable delivery (many hosts restrict or throttle raw send functions).
  • Provide clear success/error feedback to the user and write failures to a server log for debugging.

Example minimal server handler (PHP) — adapt to the hosting environment and harden before production:

<?php
// contact-handler.php
if ($_SERVER['REQUEST_METHOD'] !== 'POST') exit;
$name = trim($_POST['name'] ?? '');
$email = filter_var($_POST['email'] ?? '', FILTER_VALIDATE_EMAIL);
$subject = trim($_POST['subject'] ?? 'Website contact');
$message = trim($_POST['message'] ?? '');

if (!$email) { http_response_code(400); echo 'Invalid email'; exit; }

$to = 'owner@yourdomain.com';
$headers = "From: no-reply@yourdomain.com\r\nReply-To: {$email}\r\n";
$body = "From: {$name} <{$email}>\n\n{$message}";

if (mail($to, $subject, $body, $headers)) echo 'OK';
else { error_log('Mail failed: '.print_r($_POST, true)); http_response_code(500); echo 'Error'; }

Troubleshooting notes: check spam folders, hosting provider mail restrictions, and SPF/DKIM for the sending domain. If mail() fails or deliverability is poor, switch to authenticated SMTP or a provider API and add input sanitization and CSRF protection before going live.

Recommended Answers

All 3 Replies

u didnt do anything to allow form to send email.

should i change the '#'

it not about the # tag, u need to implement send mail function, something like PHP Mailer.. There are lot of discussion about how to send mail

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.