Page 1 of 1

need a little help with PHP mail

Posted: Wed Sep 10, 2003 2:26 am
by elitefreke
Greetings. I am kinda new to the PHP lanquage and I just wrote a script for my site where users may submit a form via email. It seems to work when "Submit" is pressed, but I am not recieving the email! Please help!

the form link is: http://www.midnightracing.org/joinapp.html

the script for the php file is:

Code: Select all

<?php
  //create short variable names
  $name=$_POST&#1111;'name'];
  $location=$_POST&#1111;'location'];
  $email=$_POST&#1111;'email'];
  $age=$_POST&#1111;'age'];
  $sex=$_POST&#1111;'sex'];
  $year=$_POST&#1111;'year'];
  $make=$_POST&#1111;'make'];
  $model=$_POST&#1111;'model'];
  $currentmods=$_POST&#1111;'currentmods'];
  $futuremods=$_POST&#1111;'futuremods'];

  $toaddress = 'webmaster@midnightracing.org';
  $subject = 'New Membership Request';
  $mailcontent = 'Name: '.$name."\n"
                 .'Age: '.$age."\n"
                 .'Email: '.$email."\n"
                 .'Sex: '.$sex."\n"
                 ."Vehicle Info: \n"
                 .'Year: '.$year."\n"
                 .'Make: '.$make."\n"
                 .'Model: '.$model."\n"
                 .'Current Mods: '.$currentmods."\n"
                 .'Future Mods: '.$futuremods."\n";
  $fromaddress = 'From: webserver@example.com';

  mail ($totaladdress, $mailcontent, $fromaddress);
?>
<html>
<head>
  <title>Feedback Submitted</title>
</head>
<body>
<center>
<h1>Feedback Submitted</h1>
<p>Your info has been sent!</p>
</center>
</body>
</html>

Posted: Wed Sep 10, 2003 2:57 am
by JayBird
shouldn't this line

Code: Select all

mail ($totaladdress, $mailcontent, $fromaddress);
be

Code: Select all

mail ($toaddress, $mailcontent, $fromaddress);
Mark

Posted: Wed Sep 10, 2003 8:46 am
by m3rajk
no. mail must have a (set of) to address(es)
then a subject
then the content


optional is other headers, such as a from address.

you have no subject, so your to addresses are getting an e-mail of a truncated message and your from address


so it should be mail($toaddress, $subject, $content, $from);

Posted: Wed Sep 10, 2003 10:53 am
by JAM
He means:
You are using these two lines in your script:

Code: Select all

$toaddress = 'webmaster@midnightracing.org';
// ...
mail ($totaladdress, $mailcontent, $fromaddress);
Are you seeing the difference?

Posted: Wed Sep 10, 2003 3:33 pm
by elitefreke
yep... i see what i did. thanks for the help!

Posted: Wed Sep 10, 2003 8:21 pm
by m3rajk
JAM wrote:He means:
You are using these two lines in your script:

Code: Select all

$toaddress = 'webmaster@midnightracing.org';
// ...
mail ($totaladdress, $mailcontent, $fromaddress);
Are you seeing the difference?
thanx. i got sidetracked with my mother's complaining about something as i wrote that.