visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: multiple results into one email per person.


By: vince2874 U.S.A.  Date: 02/10/2003 00:00:00  English  Points: 45 Status: Answered
Quality : Excellent
Hi all, got some problems here..

How can I send results from my fetch arrays (from database) to each person with one email each?



For example my fetch array results return:

$result1
$result2
$result3
$result4

//I need to send these results to 5 people but each person only receive one email containing these 4 $results. Instead of each person receive 4 emails contain of 1 result.

Will be more helpful if got some examples.

thx in advance


By: VGR Date: 02/10/2003 04:57:00 English  Type : Comment
easy. You agregate the results and format the body of your email sending in the while($res=mysql_fetch_array()) loop,

***then only*** you loop through the recipients and send each of them the whole body you prepared beforehand...

no other way

regards
By: VGR Date: 02/10/2003 17:00:00 English  Type : Answer
like :

<?php

$recipients=array('me@totor.com','yourself@ibm.com');

// here conect, perform query

// send emails with results
$themessage="";
while ($res=mysql_fetch_array($result)) { // build the message
$themessage.=$res['theresult']."\r\n"; // results will be each on its line
} // while
// now send the emails
foreach ($recipients as $email) {
mail($email,'here are your results',$themessage); // add extra headers if need be
} // foreach

?>
By: vince2874 Date: 03/10/2003 05:55:00 English  Type : Comment
thanks!
By: vince2874 Date: 10/10/2003 16:58:00 English  Type : Comment
Hi VGR,

is it possible to have the recipient fetch from my table?

$recipients=array('me@totor.com','yourself@ibm.com');

I tried this but can't work

$recipients=table[email];

any helps?

thanks

Do register to be able to answer

EContact
browser fav
page generated in 297.479870 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page