Results 1 to 15 of 15

Thread: Question in sending emails

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Location
    United States
    Posts
    157

    Question in sending emails

    Hello
    I have a website and I have about 2000 emails in database and I want to send an email to them.

    I use this code:

    PHP Code:
    $headers  "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: My Name <myemail@mywebsite>\r\n";
    $headers .= "X-Priority: 1\r\n";

    $result mysql_query("select * from table");
    while (
    $row mysql_fetch_array($result)) {
      
    mail ($row[Email],<title>,$message,$headers);
      echo 
    $row[Email] . "<br>";

    When it's starting sending, after a minute it shows me "HTTP Page Error 500".
    It sends about 200 emails then it stops and shows "HTTP Page Error 500".

    What's the problem?
    How can I solve it?


    Thanks

  2. #2
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Question in sending emails

    have you tried using sleep() to take the load of the server? Does it does it give you any other information about the error apart from 500 internal server error?

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Question in sending emails

    I think the problem is the other way round: PHP has a limit on execution time. After 30 seconds, your script is forcibly stopped.

    You can (if you have access to php.ini) increase the execution time. A better way would be to bulk-send the mails in a single call to mail(): a mail may have more than one destination. I'm not sure if and how mail() supports this, but the underlying protocol permits it.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Location
    United States
    Posts
    157

    Re: Question in sending emails

    Now I've tried to send an email to 500 person then it shows me:

    Problem Report
    Condition TCP error was detected while attempting to retrieve the URL: 'http://eenglish.onh1986.com/admin.php?show=members&page=5'.



    --------------------------------------------------------------------------------

    Problem Description: TCP/IP processing failure.

    Try RELOADING the page.

    This error message means that the target host did not properly respond to HTTP GET request after successfully establishing TCP connection. This may be due to problems like congestion on target host or transmission path.

    If this problem persists for extended periods of time, contact your network support team. Please, first make sure that the target is really reachable and not, for example, out of service due to maintenance.

    Current GMT Date/Time: Mon, 11 Sep 2006/20:29:00


    And how can I increase the execution time?
    Thanks

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Question in sending emails

    As I said, in php.ini. I think the setting is called max_execution_time.

    That's a very weird error message. What browser and server are you using?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Location
    United States
    Posts
    157

    Re: Question in sending emails

    My browser is IE 6.0.
    What do you mean about the server which I'm using?
    But this is the first time I see that page, usually I see "HTTP Error Page 500".

    max_execution_time is set to "30" in default.
    What should I do?

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Question in sending emails


  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Location
    United States
    Posts
    157

    Re: Question in sending emails

    What's set_time_limit() and what does it do?
    Will it solve my problem?

  9. #9
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Question in sending emails

    It's a link. You're supposed to click on it.

    Even if I hadn't provided a link, you could have copied and pasted it into Google search and found it instantly.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Location
    United States
    Posts
    157

    Re: Question in sending emails

    How can I use it with mail function?

  11. #11
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Question in sending emails

    look though the comments on the link to the PHP manual Penagate posted.

    PHP Code:
    set_time_limit(0); // run script forever 
    The PHP manual is the best reference for when you need to learn how to use, or what function to use in PHP. There are also loads of comments about how to use them with suggestions for other methods which you may or may not know about.

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Location
    United States
    Posts
    157

    Re: Question in sending emails

    It showed me "HTTP 500 Internal server error".

  13. #13
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Question in sending emails

    Do you use IE and have "Show HTTP Friendly Errors" turned off? Is it when you call set_time_limit?

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Location
    United States
    Posts
    157

    Re: Question in sending emails

    It always shows "HTTP 500 Internal server error" before and after I called set_time_limit().

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Location
    United States
    Posts
    157

    Re: Question in sending emails

    Please I need help.

Posting Permissions

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



Click Here to Expand Forum to Full Width