Skip to content Skip to sidebar Skip to footer

Create Email Form Using Html

I want to create a HTML form to send email. something like this: when the user enter name, email and message, press the send button and the message send to my email address. I sear

Solution 1:

You cannot send emails via HTML. You would need to submit the form to a page that can run code on the server. PHP might be a good choice for you.

email_form.html:

<html><body>
  <form action="send_email_to_minerva.php">
    Name: <input type="text" name="name"><br />
    Email: <input type="email" name="email_address"><br />
    Message:<br /><textarea name="message"><br />
    <input type="submit" value="Send">
  </form>
</body></html>

send_email_to_minerva.php:

<html><body>
  <?php
    // The message
    $name = $_GET["name"];
    $email_address = $_GET["email_address"];
    $message = $_GET["message"];
    $full_message = $name + '\n\r' + $email_address + '\n\r' + $message;
    $subject = 'Someone just emailed you from your own site';
    // Send
    mail('minerva@example.com', $subject, $full_message);
  ?>

  Your mail has been sent.
</body></html>

Post a Comment for "Create Email Form Using Html"