Re: foreach array into mail isn´t working
| From: | Jim Lucas [php] | Date: | Mon, 21 Jan 2002 22:07:46 +0000 |
| Subject: | Re: foreach array into mail isn´t working | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-81438@lists.php.net to get a copy of this message | ||
Try this:
<?
$maildb = file("mailaddr.txt");
foreach ($maildb as $address)
{
mail($address, "This is the subject.", "This is the message", "From:
\"Jose Pablo\" <josepablo@net.co.cr> \nTo: \"To Name\"
<$address>");
}
?>
Jim Lucas
bend.com
----- Original Message -----
From: "DL Neil" <PHPml@DandE.HomeChoice.co.uk>
To: "Josepablo Pérez" <josepablo@net.co.cr>; <php-general@lists.php.net>
Sent: Monday, January 21, 2002 1:59 PM
Subject: Re: [PHP] foreach array into mail isn´t working
> Josepablo,
>
> > <?
> > $maildb = file("mailaddr.txt");
> >
> > foreach ($maildb as $address)
> > { mail($address, "THis is the subject\n", "This is the message\n",
"From: josepablo@net.co.cr\n"); }
> > ?>
> >
> > The mailaddr.txt looks like:
> >
> > addr1@server.net
> > addr2@server.net
> > addr3@server.net
> >
> > However the script does send mails BUT they look like this:
> >
> > From Nobody <Root@myserver.net>
> > To addr1@server.net
> > Subject [No Subject]
> >
> > **From here down is the message body***
> >
> > Subject THis is the subject
> > From: josepablo@correo.co.cr
> >
> > This is the message
> >
> > Anybody have an idea why?? I tried it on 2 servers running PHP4 doesnt
work, however i also tried using the
> mail(...) i used up there but alone and that does work.. so the array is
screwing something up..
>
>
> =which operating system are you using?
> =what does your web server have as its admin mail address?
> =have you tried running without the \n at the end of each field?
>
> =dn
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>