-1

Here is my code.

<form action="MAILTO:example@gmail.com  " method="post" enctype="text/file">
   A3 or A4:<br>
   <input type="text" name="A3 or A4"><br>
   Add image:<br>
   <input type="file" name="image"><br>
   <input type="button" id=" value="click">
</form>

Issue: After Clicking the submit button or in this case just the button, nothing happens. I am currently using gmail so if you could please help.

YALA YOLO
  • 13
  • 4
  • This is just completely wrong. This isn't a capability of HTML. You'd need to use a server side language like PHP. – Rstew Jul 18 '17 at 00:57
  • i tried PHP and JavaScript and nothing worked. – YALA YOLO Jul 19 '17 at 01:52
  • Are you trying to send an email from the user's own email client? or are you trying to send the email from your own server? – Rstew Jul 19 '17 at 12:20
  • so when a customer fills out the form the form details get sent to me. – YALA YOLO Jul 19 '17 at 12:33
  • Yes so the approach you're trying to take will not work. You have to use something like PHP. Look at this example: https://stackoverflow.com/questions/5335273/how-to-send-an-email-using-php You have to use a web server with all the necessary email protocols such as SMTP, POP3 etc. – Rstew Jul 19 '17 at 14:20

2 Answers2

0

The button should have type="submit"

<form action="mailto:" enctype="text/file" method="post">
A3 or A4:<br> 
<input name="A3 or A4" type="text"><br>
Add image:<br>
<input name="image" type="file"><br> 
<input type="submit" value="Send">
</form>
0

First, a button of input type="button" will not prompt the POST action. You should be using a submit button:

<input type="submit" value="click"/>

Second, form action="MAILTO: " should be form action="mailto:someone@example.com".

A simple example perhaps could provide some insights. Yet, as you mentioned Gmail usage, I suggested reading Gmail API Guides in which examples of various languages are provided.

tim1234
  • 196
  • 2
  • 12
  • I left the mailto blank because i didn't know what to put in as i didn't want to use my gmail. – YALA YOLO Jul 19 '17 at 01:48
  • @YALAYOLO If you checked the example from w3schools, you will find that the html is just calling your Outlook (or other email client you are using) with information from the form. Yet, I guess what you want is a simple button click on html form which will send all the messages+attachments to the target. Since this is more advance, I suggest you reading Gmail examples to see how it could be done. – tim1234 Jul 19 '17 at 02:08