0

I have been working on a contact form for my site, but I don't receive emails. I'm not sure what I'm doing wrong. If it helps, I'm hosting on DreamHost.

HTML

          <form action="php/contact.php" method="post">
        <input type="text" name="name" placeholder="Name...">
        <input type="text" name="mail" placeholder="Email...">
        <input type="text" name="subject" placeholder="Subject...">
        <textarea name="message" placeholder="Message..."></textarea>
        <button type="submit" name="send">SUBMIT</button>
      </form>

PHP

    <?php

if (isset($_POST['send'])) {
  $name = $_POST['name'];
  $subject = $_POST['subject'];
  $mailFrom = $_POST['mail'];
  $message = $_POST['message'];
  
  $mailTo = "email@email.com";
  $headers = "From: Commissioner";
  $txt = "Commission from ".$name.".\n\n".$message;
  
  mail($mailTo, $subject, $txt, $headers);
  header("Location: ../commissions.php?error=mailsent");
}
  • https://www.php.net/manual/en/function.mail.php or get a free program at https://katorymnd.com/buy/Form/a-detailed-contact-form/158706 –  Aug 24 '21 at 23:16

1 Answers1

0

you need a mailer or support from the hoster (most hosting block the mailer)

you can use phpMailer see https://help.dreamhost.com/hc/en-us/articles/215842658-PHPMailer-overview

flaxon
  • 928
  • 4
  • 18