RE: [PHP] How to findout if the file is over
| From: | John Holmes | Date: | Tue, 30 Apr 2002 06:06:25 +0000 |
| Subject: | RE: [PHP] How to findout if the file is over | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95308@lists.php.net to get a copy of this message | ||
Please read the manual on what file() does.
www.php.net/file
It reads a file and assigns each line of it to an array. So $Emails will
be an array with each line of "emails.txt" in an element.
So, to see how many elements you have, you count() them.
$num_emails = count($Emails);
for($Cnt=0;$Cnt<$num_emails;$Cnt++)
---John Holmes...
> -----Original Message-----
> From: Rodrigo [mailto:tagzero@tagzero.com]
> Sent: Monday, April 29, 2002 7:39 PM
> To: php-general@lists.php.net
> Subject: [PHP] How to findout if the file is over
>
> I've got the following problem:
>
> I'm trying to send a number of messages to a certain number of
e-mails,
> the e-mails are writen in a text file and I need to findout when the
> file is over.
>
> The sample code is under this line , if someone can help me, I'd
> apreciate it.
>
> <?php
>
> $Emails = File('emails.txt');
> $Remetente = "Nome do remetente <email@dominio.com>";
> $Assunto = "Assunto do E-mail";
> $Mensagem = $Anuncio;
> For ($Cont=0; $Cont != feof; $Cont++)
> {
> $Destino = $Emails[$Cont];
> mail($Destino,"Assunto",$Mensagem,"From: $Remetente\n");
> }
> ?>