Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i have a single html( how to code for sending email from front-end(html from itself).
XML
<textarea class="textarea" placeholder="*Tell us more about your project here ..." id="contact_message"></textarea>
        <input type="text" class="textinput" placeholder="*Full Name" id="contact_fullname"/>
        <input type="email" class="textinput" placeholder="*Email Address" id="contact_email"/>
        <input type="text" class="textinput" placeholder="Phone Number" id="contact_phone"/>
        <input type="button" class="submit_button" value="Send Message" onclick="submit_contacts();"/>



help me how to code for send email in html ..
Posted

1 solution

HTML is not capable of sending mail or any other "active" behaviors. All you can do is to use an anchor, but it does not send e-mail, it just helps the user to start the default mail client capable of sending mail, and to fill in some of the data.

The URI scheme is "mailto"; it is explained here with examples: http://en.wikipedia.org/wiki/Mailto.

As you can see, you can fill in some optional fields in the mail client: address, subject and body. That said, this functionality is very limited. Other techniques which really can send mail are based on server-side programming.

If you have to form this URI dynamically based on some data, you can calculate the URI string and set it to the DOM of your HTML using JavaScript. If you know JavaScript, it's way too trivial, if you don't, a Quick Answer hardly can be a good place to explain all about JavaScript and DOM manipulations. So, if your JavaScript knowledge is somewhere in the middle and you want to solve such problem, feel free to ask some more specific questions on your possible concerns.

Again, HTML does not send e-mail.

—SA
 
Share this answer
 
v2
Comments
ManojMurali 16-Apr-15 1:43am    
Thanks, one doubt friend can we use some javascript or jquery or any google api codes.... for sending from html..
Sergey Alexandrovich Kryukov 16-Apr-15 1:48am    
I already answered to this question. Should I repeat what I already said? It would not be the best idea. If you did not understand any part of it, please feel free to ask.

But on top of that: As I explain, you still cannot "send from HTML", there is no such concept. But yes, in principle, you can do it indirectly (still not from HTML :-). Here is how: suppose you have some Web service or even Web site/page, where "real" sending of mail is internally implemented (on server side, of course). Then you can use that service via JavaScript. You can send any HTTP request using Ajax. Here: http://en.wikipedia.org/wiki/Ajax_%28programming%29.

Even if this is a Web mail not designed for use as if it was API, you still could, essentially, mimic all the request the human user does via a set of Ajax HTTP requests (authenticate, navigate to different page, enter mail data, and so on...). However, this is not exactly the simplest task.

And here, jQuery can help, just to simply Ajax code. Please search "jQuery Ajax"; you will immediately see the documentation on this topic.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900