Ron Gillies
|
| Posted: 02/11/2002, 2:34 PM |
|
I am trying to create the proper PHP4 code for an "After insert" event that will send a notifying email to a user.
I have looked through a number of variations here, and most of them are for ASP.
Can anyone provide either a snippet or pointer to an existing message that would allow me to send the following mail:
mail("admin@lloydminster.lib.sk.ca", "New group added", "Line 1\nLine 2\nLine 3");
Thanks
|
|
|
 |
Alex Alexapolsky
|
| Posted: 02/12/2002, 1:43 AM |
|
Refer to tell-a-friend example provided with CC (avail on this site as well)
|
|
|
 |
rick@fgritter.com
|
| Posted: 02/20/2002, 10:37 AM |
|
Ron, try this...don't forget the sleep() or the code will run past the email server. Email me if more questions. Rick@FGRitter.com
// build 'winners' email to game master here.
$subject = "Notification of raffle winners..........";
$toemail = "gamemaster@ez-raffle.com";
$headers .= "From: gamemaster@ez-raffle.com\n";
$headers .= "X-Sender: gamemaster@ez-raffle.com\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "Return-Path: gamemaster@ez-raffle.com\n";
$message = "The following entries won prizes as indicated, "
. "and need to be paid:";
$message .= "/n raffle=$raffle_id, on=$raffle_date /n";
// get the winners
$sql="SELECT * FROM x_table "
. "WHERE raffle_id = '$raffle_id' AND random_sequence <= 4";
$db1->query($sql);
while ($db1->next_record())
{
$ticket_id =$db1->f("ticket_id");
$random_sequence=$db1->f("random_sequence");
$player_id =$db1->f("player_id");
$sponsor_id =$db1->f("sponsor_id");
$email=dlookup('y_table', 'email', "player_id = '$player_id'");
$name=dlookup('y_table', 'name', "sponsor_id = '$sponsor_id'");
$message .= "/n prize#=$random_sequence, "
. "ticket=$ticket_id, player=$email, sponsor=$name. /n";
}
/* and now mail it */
// echo "message=$message";
$mail = mail("$toemail", "$subject", "$message", "$headers");
sleep (3);
|
|
|
 |
|