mail sending within a while failed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • -Nacho-

    mail sending within a while failed

    Hi all

    I have a table with some email addresses of a mailing list subscribers.
    I'm triying to send a mail to them by querying the table and sending
    the mail from a 'while' loop, but I only get sent the mail to the first
    address, and no more, and the 'while' is correct and I can see the
    debug traces from within for each address.
    I don't know if there is any reason for this, if the smtp server is
    busy sending the first mail when receiving the second and next...

    Anyone could help me, please?

    Thanks in advance and kind regards.
    -
    Nacho

  • Steve

    #2
    Re: mail sending within a while failed

    On Sun, 23 Jul 2006 23:20:03 -0700, -Nacho- wrote:
    Hi all
    >
    I have a table with some email addresses of a mailing list subscribers.
    I'm triying to send a mail to them by querying the table and sending
    the mail from a 'while' loop, but I only get sent the mail to the first
    address, and no more, and the 'while' is correct and I can see the
    debug traces from within for each address.
    I don't know if there is any reason for this, if the smtp server is
    busy sending the first mail when receiving the second and next...
    >
    Anyone could help me, please?
    >
    Thanks in advance and kind regards.
    -
    Nacho

    Try slowing it down. If the load on a server gets too high, then the mail
    server is designed to shut down.

    Steve.

    Comment

    • lironliron@gmail.com

      #3
      Re: mail sending within a while failed

      How can I slow it down to test it? I'm relatively new to php... :-S


      Thanks, Steve.
      -
      Nacho


      Steve ha escrito:
      On Sun, 23 Jul 2006 23:20:03 -0700, -Nacho- wrote:
      >
      Hi all

      I have a table with some email addresses of a mailing list subscribers.
      I'm triying to send a mail to them by querying the table and sending
      the mail from a 'while' loop, but I only get sent the mail to the first
      address, and no more, and the 'while' is correct and I can see the
      debug traces from within for each address.
      I don't know if there is any reason for this, if the smtp server is
      busy sending the first mail when receiving the second and next...

      Anyone could help me, please?

      Thanks in advance and kind regards.
      -
      Nacho
      >
      >
      Try slowing it down. If the load on a server gets too high, then the mail
      server is designed to shut down.
      >
      Steve.

      Comment

      • Noodle

        #4
        Re: mail sending within a while failed

        Try experimenting with:

        sleep()


        usleep()


        or

        time_nanosleep( )


        Comment

        • -Nacho-

          #5
          Re: mail sending within a while failed

          Thanks, Noodle, but I've just tried out the solution with a sleep of 5
          minutes and the problem persists. Only the first mail of the list is
          sent. :(

          -
          Nacho



          Noodle ha escrito:

          Comment

          • Jerry Stuckle

            #6
            Re: mail sending within a while failed

            -Nacho- wrote:
            Thanks, Noodle, but I've just tried out the solution with a sleep of 5
            minutes and the problem persists. Only the first mail of the list is
            sent. :(
            >
            -
            Nacho
            >
            >
            >
            Noodle ha escrito:
            >
            >>
            >
            5 minutes is way too long. Most servers are set up to time out scripts
            at 30 seconds or so.

            Try 2-3 seconds and see if more go out. Or, if you have a lot, try one
            of the mailing list programs freely available.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • -Nacho-

              #7
              Re: mail sending within a while failed

              I've been able to see that the problem is not due to time, but to the
              object mail I use.

              I use an object "mail" and I don't know how to kill it or to
              deinstantiate it after the first mail sending, to be able to
              instantiate it again for the next mails. This was hidden by the
              requires so it was not returning any error msg, but I've created a
              whole code embedding the code of the required files and now I get:

              Cannot redeclare class mime_mail in
              /home/transper/public_html/msend.php on line 52



              Thanks


              Jerry Stuckle ha escrito:
              -Nacho- wrote:
              Thanks, Noodle, but I've just tried out the solution with a sleep of 5
              minutes and the problem persists. Only the first mail of the list is
              sent. :(

              -
              Nacho



              Noodle ha escrito:

              >
              5 minutes is way too long. Most servers are set up to time out scripts
              at 30 seconds or so.
              >
              Try 2-3 seconds and see if more go out. Or, if you have a lot, try one
              of the mailing list programs freely available.
              >
              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              • Jerry Stuckle

                #8
                Re: mail sending within a while failed

                -Nacho- wrote:
                Jerry Stuckle ha escrito:
                >
                >
                >>-Nacho- wrote:
                >>
                >>>Thanks, Noodle, but I've just tried out the solution with a sleep of 5
                >>>minutes and the problem persists. Only the first mail of the list is
                >>>sent. :(
                >>>
                >>>-
                >>>Nacho
                >>>
                >>>
                >>>
                >>>Noodle ha escrito:
                >>>
                >>>
                >>>
                >>>>Try experimenting with:
                >>>>
                >>>>sleep()
                >>>>http://www.php.net/manual/en/function.sleep.php
                >>>>
                >>>>usleep()
                >>>>http://www.php.net/manual/en/function.usleep.php
                >>>>
                >>>>or
                >>>>
                >>>>time_nanosl eep()
                >>>>http://www.php.net/manual/en/functio...-nanosleep.php
                >>>
                >>>
                >>5 minutes is way too long. Most servers are set up to time out scripts
                >>at 30 seconds or so.
                >>
                >>Try 2-3 seconds and see if more go out. Or, if you have a lot, try one
                >>of the mailing list programs freely available.
                >>
                I've been able to see that the problem is not due to time, but to the
                object mail I use.
                >
                I use an object "mail" and I don't know how to kill it or to
                deinstantiate it after the first mail sending, to be able to
                instantiate it again for the next mails. This was hidden by the
                requires so it was not returning any error msg, but I've created a
                whole code embedding the code of the required files and now I get:
                >
                Cannot redeclare class mime_mail in
                /home/transper/public_html/msend.php on line 52
                >
                >
                >
                Thanks
                >
                >

                (Top posting fixed)

                Not being familiar with mime_mail (or even which version of mime_mail -
                a quick Google search shows several of them) I can't help you. But
                embedding files the second time is never the answer.

                Where did you get the files? Do they have a support forum?

                If not, you could try posting your failing code (not the redeclaration
                error - the first error). It's impossible to tell what your problem is
                without it.

                P.S. Please don't top post. This group uses bottom posting as a standard.

                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstucklex@attgl obal.net
                =============== ===

                Comment

                • Miguel Cruz

                  #9
                  Re: mail sending within a while failed

                  "-Nacho-" <yoestepario@ho tmail.comwrote:
                  I've been able to see that the problem is not due to time, but to the
                  object mail I use.
                  >
                  I use an object "mail" and I don't know how to kill it or to
                  deinstantiate it after the first mail sending, to be able to
                  instantiate it again for the next mails. This was hidden by the
                  requires so it was not returning any error msg, but I've created a
                  whole code embedding the code of the required files and now I get:
                  >
                  Cannot redeclare class mime_mail in
                  /home/transper/public_html/msend.php on line 52
                  This:

                  Class mime_mail { blah blah }

                  needs to be before your while loop.

                  Also make sure you are not include()ing the file containing this:

                  Class mime_mail { blah blah }

                  within your while loop.

                  miguel
                  --
                  Photos from 40 countries on 5 continents: http://travel.u.nu
                  Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
                  Airports of the world: http://airport.u.nu

                  Comment

                  • -Nacho-

                    #10
                    Re: mail sending within a while failed


                    Miguel Cruz ha escrito:
                    "-Nacho-" <yoestepario@ho tmail.comwrote:
                    I've been able to see that the problem is not due to time, but to the
                    object mail I use.

                    I use an object "mail" and I don't know how to kill it or to
                    deinstantiate it after the first mail sending, to be able to
                    instantiate it again for the next mails. This was hidden by the
                    requires so it was not returning any error msg, but I've created a
                    whole code embedding the code of the required files and now I get:

                    Cannot redeclare class mime_mail in
                    /home/transper/public_html/msend.php on line 52
                    >
                    This:
                    >
                    Class mime_mail { blah blah }
                    >
                    needs to be before your while loop.
                    >
                    Also make sure you are not include()ing the file containing this:
                    >
                    Class mime_mail { blah blah }
                    >
                    within your while loop.
                    >
                    miguel
                    --
                    Photos from 40 countries on 5 continents: http://travel.u.nu
                    Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
                    Airports of the world: http://airport.u.nu


                    Thanks, Miguel.
                    The problem was just there. I was invoking the class constructor within
                    the loop. I got the include() out of the loop and now everything is
                    working fine.

                    Thanks a lot!
                    -
                    Nacho

                    Comment

                    Working...