Jump to content

Mailto Forms without email dialog popping up


ProgramPotato

Recommended Posts

Hello, In the tororials of w3chools it has a toutorial for form building and then sending through email. When the submit button is pressed, an email dialog box from wichever email program you are using poppes up. I would not like that to happen, I just want the email to be sent without the person being able to edit it to their will. Hopefully, there is a way! EDIT: I was using an html mailto instead of php. I don't know php. So I need help

Edited by ProgramPotato
Link to comment
Share on other sites

Guest So Called

I have absolutely no idea what you're talking about. The site visitor's email client opens when they click your form? Are you sure you're not posting a mailto link? (mailto:somebody@example.com) I've written several contact forms and I've never had that happen even once. I was recently looking at the W3Schools mail form example and it works fine without any email client program opening.

<html><body><?phpif (isset($_REQUEST['email']))//if "email" is filled out, send email  {  //send email  $email = $_REQUEST['email'] ;  $subject = $_REQUEST['subject'] ;  $message = $_REQUEST['message'] ;  mail("someone@example.com", $subject,  $message, "From:" . $email);  echo "Thank you for using our mail form";  }else//if "email" is not filled out, display the form  {  echo "<form method='post' action='mailform.php'>  Email: <input name='email' type='text' /><br />  Subject: <input name='subject' type='text' /><br />  Message:<br />  <textarea name='message' rows='15' cols='40'>  </textarea><br />  <input type='submit' />  </form>";  }?></body></html>

http://www.w3schools.com/php/php_mail.asp

Link to comment
Share on other sites

mailto will always open your local email client .you have to submit your form to any server side pages and you have process it and send the email using any server side language. eg php has mail() function for that.

Link to comment
Share on other sites

Guest So Called
Thanks, but how do i get the ending "; } ?> out of my page? I think it's broken. Do i have to save it as a separate file?
Not possible to answer that unless you post some code. Otherwise we have no idea what you're talking about.
Link to comment
Share on other sites

Not possible to answer that unless you post some code. Otherwise we have no idea what you're talking about.
It's your code, the one you gave me. Try it in an html document. The last 6 characters don't get included in the php
Link to comment
Share on other sites

You need to upload the file to a server that supports PHP. You can't run this from your desktop.
thank you. So do you mean after i host my website i will be able to use php? Edited by ProgramPotato
Link to comment
Share on other sites

Guest So Called
EDIT: I was using an html mailto instead of php. I don't know php. So I need help
Okay, now there's enough information to answer your question. You can't do what you want without server side scripts. The link you're using automatically opens the visitor's email client to allow them to send an email to your email address. Once that happens they can send anything they want. You threw me off when you said email form. There aren't any HTML-only email forms. You need a server side script to process them.
Link to comment
Share on other sites

Okay, now there's enough information to answer your question. You can't do what you want without server side scripts. The link you're using automatically opens the visitor's email client to allow them to send an email to your email address. Once that happens they can send anything they want. You threw me off when you said email form. There aren't any HTML-only email forms. You need a server side script to process them.
You're able to use "mailto:" as the action attribute of a form, which will open the e-mail client and put some data into the subject, to and body fields.
Link to comment
Share on other sites

You're able to use "mailto:" as the action attribute of a form, which will open the e-mail client and put some data into the subject, to and body fields.
Okay, now there's enough information to answer your question. You can't do what you want without server side scripts. The link you're using automatically opens the visitor's email client to allow them to send an email to your email address. Once that happens they can send anything they want. You threw me off when you said email form. There aren't any HTML-only email forms. You need a server side script to process them.
I understand this. That is what i did originally, but I don't want it to open an email, i want to just send the form to my email with whatever they entered in.
Link to comment
Share on other sites

So do you mean after i host my website i will be able to use php?
you can use your host or you can install a server and php on your pc. you can use WAMP,MAMP,LAMP which is package of php,mysql,apache and others for windows,mac,linux respectively. if you want to send the mail from your local server you need a email server in your localhost which you may need to configure to get it working. I use XAMPP which comes with email server so i am not sure wamp,lamp.,mamp comes with email server or not. .your host is probably installed and configured email server to send emails already.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...