Loading ...
Sorry, an error occurred while loading the content.
 

Re: [bang-phpug] Send emails to multiple recepients..

Expand Messages
  • jatinder kaur
    hi mohan, FIle elist.txt firstemail@here.com secondemail@there.com yourplace@somewhere.com another@elsewhere.com
    Message 1 of 3 , Sep 6, 2007
      hi mohan,

      FIle elist.txt

      firstemail@...
      secondemail@...
      yourplace@...
      another@...

      <?php
      // read the list of emails from the file.
      $email_list = file("elist.txt");

      // count how many emails there are.
      $total_emails = count($email_list);

      // go through the list and trim off the newline character.
      for ($counter=0; $counter<$total_emails; $counter++) {
      $email_list[$counter] = trim($email_list[$counter]);
      }

      // implode the list into a single variable, put commas in, apply as $to
      value.
      $to = implode(",",$email_list);

      $subject = "My email test.";
      $message = "Hello, how are you?";

      if ( mail($to,$subject,$message) ) {
      echo "The email has been sent!";
      } else {
      echo "The email has failed!";
      }
      ?>


      On 8/28/07, syam mohan <syammohan_ch@...> wrote:
      >
      > Hai Friend..
      >
      > I need to perform the newsletter section of a web site . How do i send
      > email to multiple receipients(registrered users of the site) . i want to use
      > mail() function. How can i do that please send me some code samples
      >
      > ---------------------------------
      > Yahoo! oneSearch: Finally, mobile search that gives answers, not web
      > links.
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >


      [Non-text portions of this message have been removed]
    • ganu
      hey, what about giving this work to some background process. let say you have 1000 mails to send and you will send from PHP page and you will wait till the
      Message 2 of 3 , Sep 11, 2007
        hey,

        what about giving this work to some background process.

        let say you have >1000 mails to send and you will send from PHP page and you
        will wait till the >1000 mails are sent. not sure but the page will be
        stuck.

        what about the sending mail from perl. that will be fast and efficient.
        create the mail message and to-mail. make a big perl hash and say exec('perl
        send.pl') or set this in cron.

        so in background perl will send all the mail efficiently and you can
        continue your work in PHP.

        --------
        ganu~ullu

        On 9/6/07, jatinder kaur <jatinderkaur100@...> wrote:
        >
        > hi mohan,
        >
        > FIle elist.txt
        >
        > firstemail@... <firstemail%40here.com>
        > secondemail@... <secondemail%40there.com>
        > yourplace@... <yourplace%40somewhere.com>
        > another@... <another%40elsewhere.com>
        >
        > <?php
        > // read the list of emails from the file.
        > $email_list = file("elist.txt");
        >
        > // count how many emails there are.
        > $total_emails = count($email_list);
        >
        > // go through the list and trim off the newline character.
        > for ($counter=0; $counter<$total_emails; $counter++) {
        > $email_list[$counter] = trim($email_list[$counter]);
        > }
        >
        > // implode the list into a single variable, put commas in, apply as $to
        > value.
        > $to = implode(",",$email_list);
        >
        > $subject = "My email test.";
        > $message = "Hello, how are you?";
        >
        > if ( mail($to,$subject,$message) ) {
        > echo "The email has been sent!";
        > } else {
        > echo "The email has failed!";
        > }
        > ?>
        >
        > On 8/28/07, syam mohan <syammohan_ch@... <syammohan_ch%40yahoo.com>>
        > wrote:
        > >
        > > Hai Friend..
        > >
        > > I need to perform the newsletter section of a web site . How do i send
        > > email to multiple receipients(registrered users of the site) . i want to
        > use
        > > mail() function. How can i do that please send me some code samples
        > >
        > > ---------------------------------
        > > Yahoo! oneSearch: Finally, mobile search that gives answers, not web
        > > links.
        > >
        > > [Non-text portions of this message have been removed]
        > >
        > >
        > >
        >
        > [Non-text portions of this message have been removed]
        >
        >
        >


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.