PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old June 14th, 2004, 02:42 AM
Alicia Alicia is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 116 Alicia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 49 sec
Reputation Power: 5
send email to multiple recipient

Hi guys,

I am trying to send out an email to all the emails i got in my db.. this is the code i wrote.. the code looks fine to me... i can receive the email but the content is keep on looping..

my first email got a copy of the content, second email got two copies of duplicated content in the same email, third one with three duplicated copies and so on... for instace :
1st email :
====================
Personal Information
====================

2nd email :
====================
Personal Information
====================
====================
Personal Information
====================

3rd email
====================
Personal Information
====================
====================
Personal Information
====================
====================
Personal Information
====================

and so on...


how could i make the code only send one copy of the content to all email addresses i have in my db ??? like :
====================
Personal Information
====================

only??


please advise..


Code:
include("listconfig.php"); 

$web_add = "travel";

		$connection = mysql_connect($dbhost, $dbusername, $dbpassword);
		$query = "SELECT * FROM listsubscribers WHERE web_add='$web_add'";
		$result = mysql_db_query($dbname, $query) or die (mysql_error());
		

		while($row = mysql_fetch_array($result))
		{			
		
$to = "{$row['email']}\r\n";
//$from= "From: $name < $email >\r\n";
$from= "From: testing while< myemail >\r\n";
$subject ="$name - online shopping order\r\n";

$contents .="
====================
Personal Information
====================
";

mail($to,$subject,$contents,$from);
if(mail)
			{
	echo ' email is sent';
	echo "<br>".$row['email']."<br>";
			}
		} // close while loop


thank you...

Reply With Quote
  #2  
Old June 14th, 2004, 06:43 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
At the beginning of the loop (just inside the while statement), you need to reset $contents to blank. Or just use the = operator rather than the .= operator when you're setting $contents in the first place.
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > send email to multiple recipient


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway