Click to See Complete Forum and Search --> : mail() sending twice


awebb
06-25-2003, 07:48 AM
I have the mail() function working (hooray!) but it seems to send twice.
The first time there are the fields but with nothing in them and then in the second the fields are properly populated.
Any ideas?
Heres the code:

/* emailing info, first set variables*/
$fname=$HTTP_POST_VARS['firstname'];
$lname=$HTTP_POST_VARS['lastname'];
$startdate=$HTTP_POST_VARS['startdate'];
$weeks=$HTTP_POST_VARS['weeks'];
$email=$HTTP_POST_VARS['email'];
$toaddress='webmaster@sitename.com';
$fromaddress='Clouseau';
$subject='New Booking';
/* The body text */
$content= 'Name: '.$fname.' '.$lname."\n"
.'Starting: '.$startdate."\n"
.'Weeks: '.$weeks."\n"
.'Email: '.$email."\n";
/* send the info */
mail ($toaddress, $subject, $content, $fromaddress);

pyro
06-25-2003, 07:50 AM
The code you posted should not be causing it to do that. It is perhaps a problem somewhere else in your code, or a problem on your servers end...

justo_13
07-21-2009, 02:39 PM
The problem may be the way you send the form.

JunkMale
07-22-2009, 04:17 AM
mail function... http://www.php.net/manual/en/function.mail.php

Your $fromaddress does not appear to be a valid header value...