•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,437 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,642 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 457 | Replies: 5
![]() |
•
•
Join Date: Nov 2006
Posts: 37
Reputation:
Rep Power: 3
Solved Threads: 0
I'm trying to email to an array of subscribers to a weekly newsletter. Whenever I try though, I get an error "Bad parameters to function mail()". Heres the loop I'm using to mail:
Any help would be appreciated, thanks.
php Syntax (Toggle Plain Text)
$x = 0; $y = 1; while ($x <= $y) { mail($names[$x], "Hey", "Whats up?"); $x++; }
Any help would be appreciated, thanks.
Last edited by Firestone : Aug 5th, 2007 at 5:47 pm.
=================================
There are 10 types of people in the world,
Those who understand binary, and those who don't
=================================
There are 10 types of people in the world,
Those who understand binary, and those who don't
=================================
•
•
Join Date: Aug 2007
Location: Italy
Posts: 42
Reputation:
Rep Power: 2
Solved Threads: 4
Check the array. While function works fine to me. I have done it like this:
Bye.
php Syntax (Toggle Plain Text)
$names[] = 'name1@host.tld'; $names[] = 'name2@host.tld'; $names[] = 'name3@host.tld'; $x = 0; $y = 2; while ($x <= $y) { mail($names[$x], "hey", "whats up?"); $x++; }
Bye.
If you use foreach() you won't even need to bother with the indexing.
php Syntax (Toggle Plain Text)
<?php $list[] = "first"; $list[] = "second"; $list[] = "third"; foreach ($list as $entry){ mail($entry, "Hey", "Whats up?"); } ?>
•
•
Join Date: Nov 2006
Posts: 37
Reputation:
Rep Power: 3
Solved Threads: 0
I populated the array with a loop, that read the names from a text file. I tried doing it manually, and it worked, but I cant do it that way for what I'm doing. @Ezzaral: What is foreach()? Would that help?
=================================
There are 10 types of people in the world,
Those who understand binary, and those who don't
=================================
There are 10 types of people in the world,
Those who understand binary, and those who don't
=================================
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Can I ghost a RAID array??? (Windows NT / 2000 / XP / 2003)
- Creating dynamic array structures (C++)
- Array limit (C)
- struct dynamic 2d array alloc (C)
- string to integer array transformation (C)
- Array (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: PHP auto display
- Next Thread: Adding minutes to a timestamp



Linear Mode