How to automatically open email when a page loads

I would like to automatically open an email using the To topic and the subject when the html page loads. I need to use only mailto functions. Can someone help me how to do this?

+3
source share
2 answers

Redirect the user to the link mailto. This can be done using basic JavaScript:

location.href = "mailto:you@example.com?subject=Test+Message";

Just keep in mind the fact that:

  • Many people use email these days (GMail, hotmail, etc.) - not me personally, but ... other people.
  • If the user has an email program for the desktop, you will force an unexpected window to them.
  • , , - 1. , .

.

+8

-

      <html>
       <head>

       <script type="text/javascript">
        function mymessage()
        {
         location.href = "mailto:you@example.com?subject=Hello";

         }
        </script>
    </head>

    <body onload="mymessage()">
    </body>

     </html>
+2

All Articles