Home > Enterprise >  in my html code after hitting submit it doesn't do anything i want it to take me to gmail
in my html code after hitting submit it doesn't do anything i want it to take me to gmail

Time:12-26

   <form action="Gmailto:[email protected]" method="post" enctype="text/plain">
        <label>Your Name:</label>
        <input type="text" name="YourName" value=""><br>
        <label>Your Email:</label>
        <input type="email" name="YourEmail" value=""><br>
        <label>Your Message:</label> <br>
        <textarea name="Message" id="YourMessage" cols="31" rows="7"></textarea>
        <br><input type="submit">
    </form>

i tried channging the email, security and all that stuff

CodePudding user response:

The mailto: url scheme is a generic email scheme, not one specific to GMail. There isn't a URL scheme specific to GMail. There is no g at the front of it.

The browser needs to know about the email client you are using for them to work, and since GMail is a web app and not local software, it can't register itself at the OS level, so end users need to configure their browser to use mailto URLs with GMail.

mailto: URLs are notoriously unreliable as the value of a form action so you should avoid them anyway.


If you want to handle form data, then use server side programming. It's much more reliable and gives you control over the UX.

CodePudding user response:

You have a typo in the action, it's mailto:, not Gmailto:

Your overall code is correct, except for where you are doing a POST request, email clients will often expect certain format of query parameter which is done by using GET method. Check this for reference - https://stackoverflow.com/a/21046049/1391805

CodePudding user response:

The only thing that needs to be fixed in your code is 'Gmailto' There is nothing as Gmailto in html. Instead you have to select 'mailto'. So that when you click submit you will be redirected to your computer's emailing software as you requested. From there you can select your gmail account to continue.

  • Related