0

I'm trying to create my own website using this HTML5 template. I have no background in HTML.

I'm trying to make the last section, Contact Me, send a message directly from the website. The code that I think is relevant from the link above (again, no background in HTML) is:

<section id="Contact">
    <div class="container">
        <h3>Contact Me</h3>
        <p>Integer eu ante ornare amet commetus vestibulum blandit integer in curae ac faucibus integer non. Adipiscing cubilia elementum integer. Integer eu ante ornare amet commetus.</p>
        <form method="post" action="#">
            <div class="row gtr-uniform">
                <div class="col-6 col-12-xsmall"><input type="text" name="name" id="name" placeholder="Name" /></div>
                <div class="col-6 col-12-xsmall"><input type="email" name="email" id="email" placeholder="Email" /></div>
                <div class="col-12"><input type="text" name="subject" id="subject" placeholder="Subject" /></div>
                <div class="col-12"><textarea name="message" id="message" placeholder="Message" rows="6"></textarea></div>
                <div class="col-12">
                    <ul class="actions">
                        <li><input type="submit" class="primary" value="Send Message" /></li>
                        <li><input type="reset" value="Reset Form" /></li>
                    </ul>
                </div>
            </div>
        </form>
    </div>
</section>

I was trying to understand which part of it I need to change to make this happen. From this SO question I understand that the relevant line might be <form method="post" action="#">. I changed it to be <form method="post" action="mailto:my_email@gmail.com">, but it opens the user's outlook email instead of directly sending from the website, and the message in the outlook is also messed up: name=some_name&email=some_email_test&subject=test&message=some+message

Penguin
  • 1,923
  • 3
  • 21
  • 51
  • 1
    You can't have the server send email using plain HTML. The answer in that SO post uses a `mailto:` link which causes the browser to open the users' default mail program. To send from the server, you need to submit the POST data to script code like PHP or ASP.NET running on the server, that then uses some email account of your own and your own mail server to send the email. – Dave S Dec 31 '22 at 04:36
  • As @DaveS said, you can't do this with plain HTML. You'll need a backend server that sends the email itself. Using only HTML, you'll only be able to use the `mailto` link (can be a form or anchor tag href) which opens up the default mail program. – Cjmarkham Dec 31 '22 at 04:38
  • You cannot directly send an email without a server. If you use only html it will always open a client to send email – Ritankar Bhattacharjee Dec 31 '22 at 04:38

0 Answers0