Old 03-02-2005, 12:28   #1 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
What the...blank emails?

OK, so I finally added a mail form to my site - with a PHP script to process the HTML form. It works great. Until I checked my Gmail just a minute ago and I found 18 emails from "devnull@kundenserver.de" - all blank from 5:28AM (all of 'em).

I believe this "kundenserver" has something to do with my current domain registrar, Schlund & Partners through 1&1 (can't beat 3 free years!).

Anyway, I'm not sure if and how I can stop this. Here's the PHP script...
PHP Code:
<?php
$myemail
="myemail@gmail.com";
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POST['comments'];

$message "This is an automated email.  Someone submitted the form on your site.  Message follows:\nName: $name\nEmail: $email\nComments: $comments\n";

mail ($myemail"Contact Form"$message);

header("Location: thanks.html");
?>

Is there and if/then statement I can add to this like - "IF $email='devnull@kundenserver.de' THEN..." end or error or something. I don't really know PHP, I just got this script somewhere or other - I had used it on another site for a friend, but he never said anything about getting blank emails?

Perhaps is just something isolated with 1&1 and/or Schlund/Partner - in which case, I'm OK - because I submitted a request for a change of registrar to Go Daddy and will be getting new hosting as soon as that comes through.

Thanks in advance!
  Reply With Quote
Old 03-02-2005, 12:42   #2 (permalink)
seen.to
unusual suspect ™
 
seen.to's Avatar
 
Join Date: Jul 2004
Location: DE, USA
Posts: 3,155
Does the form work otherwise when you test it?

Did the e-mail from devnull@kendenserver.de have your subject line? (ie could it just be coincidence)
__________________
  Reply With Quote
Old 03-02-2005, 12:47   #3 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
It works fine otherwise.

And, yes, everything was the way it was supposed to be - I just got 18 emails from the same email address through the form in the span of 1 minute (not a human filling out the form).
  Reply With Quote
Old 03-02-2005, 13:02   #4 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,572
Don't bother singling out a particular sender. Set it up to test the fields first - if they're blank, don't send.

www.hotscripts.com
  Reply With Quote
Old 03-02-2005, 13:03   #5 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Quote:
Originally Posted by Stickman
Don't bother singling out a particular sender. Set it up to test the fields first - if they're blank, don't send.

www.hotscripts.com

You're a quick one aren't you? Much appreciated, I'll look into it.
  Reply With Quote
Old 03-02-2005, 13:20   #6 (permalink)
DRAGLiNE
shit happens
 
DRAGLiNE's Avatar
 
Join Date: Apr 2004
Location: Glasgow, Scotland
Posts: 99
Send a message via AIM to DRAGLiNE Send a message via Yahoo to DRAGLiNE
How are you setting up the HTML for the form? Are you using action="some.php(ie your form processing php script)" or are you using action="$PHP_SELF" to tell it to process the form using the PHP on the same page as the form? I had a similar problem when I used this in that every visitor to the page generated an email automatically, whether they had filled in the form or not. Solved it by putting the processing php into its own file and setting the action to "mail.php" or something similar.

May not be this, but just an idea.
  Reply With Quote
Old 03-02-2005, 13:48   #7 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Thanks for the help everyone! So prompt, too! I need to get to bed now...

I think I've fixed it, but if you're still curious how I've set it up, DRAGLiNE, here you go...

There are three HTML pages (used to be 2) contact.html, error.html, and thanks.html - they are, of course, styled with CSS - quite a bit of CSS, actually...
HTML Code:
<form action="sendmail.php" id="sendmail" method="post"> <dl> <dt><label for="name">Name:</label></dt> <dd><input type="text" id="name" name="name" /></dd> <dt><label for="email">Email:</label></dt> <dd><input type="text" id="email" name="email" /></dd> <dt><label for="comments">Comments:</label></dt> <dd><textarea id="comments" name="comments" cols="43" rows="10"></textarea></dd> <dt><input type="submit" name="submit" value="Submit" class="button" /></dt> </dl> </form>

And the NEW PHP looks like this...I just found a few tutorials on error checking forms and threw them together logically - even though I know absolutely no PHP - and it worked!

PHP Code:
<?php
$myemail 
"myemail@gmail.com";
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POST['comments'];

if (empty(
$name) || empty($email) || empty($comments)){
header("Location: error.html");
}
else
{
$message "This is an automated email.  Someone submitted the form on your site.  Message follows:\nName: $name\nEmail: $email\nComments: $comments\n";

mail ($myemail"Contact Form"$message);

header("Location: thanks.html");
}
?>

I wish my email really was "myemail@gmail.com"!

Geez, with all this extra programming and error and thanks pages - my site's up to a whopping 200KB!!!
  Reply With Quote
Old 03-02-2005, 19:43   #8 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,147
Quote:
Originally Posted by pgo
You're a quick one aren't you?
especially for her age.
  Reply With Quote
Old 04-02-2005, 00:35   #9 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Quote:
Originally Posted by Brown
especially for her age.

My grandma struggles with sending email through AOL!

I'm impressed.
  Reply With Quote
Old 04-02-2005, 05:30   #10 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,572
Thanks kids.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8