View previous topic :: View next topic |
Author |
Message |
mitchsb -
Joined: 22 Jul 2007 Posts: 27 Location: Torranc, CA
|
Posted: Sun Jul 06, 2008 7:28 pm Post subject: comment form |
|
|
Hey all, this may seem a little basic, but I'm having problems with setting up a comment form on my web site.
I know how to do a form, but I can't get the information to submit directly to MY email address. Instead, when somebody (me) puts in the information, an email client launches.
Now, I have read around a bit and I've found various webmail servers and and some scripts to do this, but most of them are rather complicated and all I want to do is set up ONE form so people can comment on my website AND have it set up so that the submit button automatically sends me an email with the form data.
What is the easiest and quickest way to do this? |
|
Back to top |
|
|
p3 -
Joined: 17 Jun 2005 Posts: 615
|
Posted: Mon Jul 07, 2008 6:59 am Post subject: |
|
|
The easiest way (in my opinion, anyway), would just be to use a simple form and a PHP script to shoot the email off. Form: Code: | <form action="sendemail.php" method="post">Subject: <input type="text" name="subject" /><br />
Message:<br />
<textarea rows="6" cols="80" name="message"></textarea><br />
<input type="submit" name="submit" value="Send Email" />
</form> |
And the PHP
Code: | <?php
$email = 'youraddress@example.com'; //Edit me
if(empty($_POST['subject']) || !isset($_POST['subject']) || empty($_POST['message']) || !isset($_POST['message']))
{
die("One or more fields was not filled. Please go back and complete the form.");
}
else
{
mail($email, $_POST['subject'], $_POST['message']);
echo 'Your message has been sent.';
}
?> |
Also, what's with all the lesbian CENSORED? There's about a dozen ways to stop the robots with phpBB2 (I remember hearing you guys say you were working on a custom solution, but no signs as of yet ;) ) |
|
Back to top |
|
|
pkSML -
Joined: 29 May 2006 Posts: 952 Location: Michigan, USA
|
Posted: Fri Jul 18, 2008 7:11 pm Post subject: |
|
|
I know this is answering your question a little late, but here is a solution I use. See: http://pksml.net/redirect.php?page=gmail_php
It's a script that will take information from a contact form and send an email through Gmail to your address.
Note that the email may wind up in your spam folder until you add the sending Gmail address to your address book. _________________ Stephen
Need a LitlURL?
http://CodeBin.yi.org |
|
Back to top |
|
|
mitchsb -
Joined: 22 Jul 2007 Posts: 27 Location: Torranc, CA
|
Posted: Fri Jul 18, 2008 8:55 pm Post subject: |
|
|
Looks like a great solution. I'll try this once I get PHP to work properly. |
|
Back to top |
|
|
DonQuichote -
Joined: 24 Dec 2006 Posts: 68 Location: The Netherlands
|
Posted: Sat Jul 19, 2008 8:42 am Post subject: Hacking |
|
|
The given form is really simple. So simple, in fact, that all hackers (and bots!) passing by will gladly abuse it for spamming. Please do a net search for "header injection" or "email injection" to see why.
If you are going the PHP way, just see if you can find some open source contact form or at least validate the inputs (the subject field is the most important here). |
|
Back to top |
|
|
JaturontThan -
Joined: 29 May 2008 Posts: 3
|
Posted: Mon Aug 11, 2008 8:46 am Post subject: |
|
|
You also have to save the comments into a text file or put it into the database to keep it. Otherwise it will just show the comment and never be saved. _________________ Cosmetic Surgery Thailand
Plastic Surgery Thailand |
|
Back to top |
|
|
swissboney3 -
Joined: 02 Jul 2005 Posts: 31
|
Posted: Mon Aug 11, 2008 10:33 pm Post subject: |
|
|
if youre gonna put it into a database, make sure you use mysql_real_escape_string($var-to-escape). this stops attempts at mysql injections. read up on mysql injection attacks on the net...dangerous things |
|
Back to top |
|
|
|