emails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    emails

    Hello guys

    I have to send HTML email to over 1000 email addresses and I believe that at some point server will stop sending them even if my script works perfect on fewer email addresses. Basically I am looping through an array like this

    [PHP]
    $message = "some html";
    $emails = array("email1@e xample.com", "email2@example .com",.... );
    foreach($emails _array as $email){

    $headers = 'MIME-Version: 1.0";
    $headers .= 'Content-type: text/html; charset=iso-8859-1";
    $headers .= 'To: $email' . "\r\n";
    $headers .= 'From: Buldog Promo<name@exam ple.com>' ";
    mail($email, $subject, $message, $headers);
    }
    [/PHP]

    My question is:
    What is max number of elements array $emails should hold?
    OR
    Do you know way around this problem

    Thank you for your Help
    Last edited by Atli; Oct 2 '08, 06:59 PM. Reason: Replaced real email domains with example.com
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Best thing you could do is contact your hosting provider and find out if they have a cap on how many emails you can send, say, per hour. PHP itself, as far as I know, doesn't limit the emails, but it will crash if you don't set the max execution time.

    Cheers,
    Markus.

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hi.

      PHP doesn't limit it, but like Markus says, your host might.

      You could also try sending to multiple email addresses at once.
      See the manual for examples.

      Or better yet, you could try one of the mailer classes, like PHPMailer. Usually works a lot better than the mail function. The manual even mentions that using the mail function with complex mails, like HTML mails, is not recommended.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by Atli
        Hi.

        PHP doesn't limit it, but like Markus says, your host might.

        You could also try sending to multiple email addresses at once.
        See the manual for examples.

        Or better yet, you could try one of the mailer classes, like PHPMailer. Usually works a lot better than the mail function. The manual even mentions that using the mail function with complex mails, like HTML mails, is not recommended.
        You should be on PHPMailer's payroll, considering all the effort you put in to marketing them.

        :P

        Markus.

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Heya, Zorgi.

          Is your script completing without any errors? Perhaps it times out after 1000 or so emails?

          Comment

          • zorgi
            Recognized Expert Contributor
            • Mar 2008
            • 431

            #6
            Originally posted by pbmods
            Heya, Zorgi.

            Is your script completing without any errors? Perhaps it times out after 1000 or so emails?
            Thank you guys,

            Script works great. All information I got here was very useful and needed. I would also recommend PHPMailer if you don't want your emails to end up in someones junk mail. Also... do contact your host and ask them how many emails you can send an hour.

            Comment

            Working...