SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot detzX's Avatar
    Join Date
    Oct 2006
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why does my php mail script send multiple copies?

    PHP Code:
    <?php

        $name 
    $_POST["name"];
        
    $email $_POST["email"];
        
    $device $_POST["device"];
        
    $feedback $_POST["feedback"];

        
    $to "MY EMAIL";
        
    $subject "Feedback.";

        
    $headers "From: $email\n";
        
    $message "From: $name ( $email )
    Device: 
    $device

    --------------
    $feedback
    --------------

        "
    ;

        
    $mail_sent = @mail$to$subject$message$headers );
        
    header("Location:index.php?feedback=1");
    ?>
    I don't understand it, it must be something with the server. I have this very basic script and another wordpress plugin and they both(sometimes) send multiple emails. Some up to 5-6 duplicates. Any ideas?
    www.invoicejournal.com - Invoice clients for Free

  2. #2
    SitePoint Guru
    Join Date
    Jun 2006
    Posts
    638
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code you posted, wouldn't it happen to be in index.php ?

  3. #3
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a condition that has to be met in order for the email to send, or is it open to run whenever the page is accessed?
    No, I REALLY dislike having to use Joomla.

  4. #4
    SitePoint Zealot detzX's Avatar
    Join Date
    Oct 2006
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Vali View Post
    The code you posted, wouldn't it happen to be in index.php ?
    no, feedback.php, index.php posts to it.
    www.invoicejournal.com - Invoice clients for Free

  5. #5
    SitePoint Zealot detzX's Avatar
    Join Date
    Oct 2006
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by crowden View Post
    Is there a condition that has to be met in order for the email to send, or is it open to run whenever the page is accessed?
    no condition but I don't get blank emails I get emails with the data posted so they are coming form the previous page.
    www.invoicejournal.com - Invoice clients for Free

  6. #6
    SitePoint Guru
    Join Date
    Jun 2006
    Posts
    638
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you sure your not double clicking the submit button or something?

    Since 1 mail call sends 1 email.

  7. #7
    SitePoint Zealot detzX's Avatar
    Join Date
    Oct 2006
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Vali View Post
    are you sure your not double clicking the submit button or something?

    Since 1 mail call sends 1 email.
    It's not me sending the feedback it's others. I just did filled out the form and it worked fine and I only got one but what I did notice is it took about 20 seconds to send so it might be people clicking the button over and over because it's taking so long?

    So, what would make the php mailer hang?
    www.invoicejournal.com - Invoice clients for Free

  8. #8
    SitePoint Zealot detzX's Avatar
    Join Date
    Oct 2006
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A simple tail of the maillog gave me this.
    My unqualified host name, sleeping...

    so I added my hostname to my hosts file and now it's super fast! I hope that's what the problem was, people were impatient and clicked it multiple times.
    www.invoicejournal.com - Invoice clients for Free


Bookmarks

Posting Permissions

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