www.webdeveloper.com
Results 1 to 4 of 4

Thread: mail() sending twice

  1. #1
    Join Date
    Jun 2003
    Location
    The Alps
    Posts
    36

    mail() sending twice

    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);

  2. #2
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    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...

  3. #3
    Join Date
    Jul 2009
    Posts
    1
    The problem may be the way you send the form.

  4. #4
    Join Date
    Jan 2009
    Location
    Insanity
    Posts
    1,131
    mail function... http://www.php.net/manual/en/function.mail.php

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles