:cry: Hi,
You quickly gave me a answer... but I got the randomizer working... The problem is that even after using yours or other suggested scripts... the message received by the "recipient" comes from the "root server address". I want to be able to customize this.
Even after doing the following script... I get the same result!
<?php
$to = "jason@example.com";
$from = "support@example.com";
$title = "Support subscription confirmation";
$body = <<< emailbody
Dear subscriber,
This email confirms your purchase of a 30 day
email support subscription. Please direct all
requests to [email]support@example.com[/email].
Any ideas????
Kentf
[email]kent@via-media.com[/email]
paradox814
Junior Poster
Join Date: Oct 2004
Location: San Francisco, CA
Posts: 241
Rep Power:
Re: Using PHP to Send Email to a single DB list member every 24 hrs.
Feb 1st 2006, 08:59 PM | #2
I don't understand what your question is, do you not know how to randomly select a user from the database? do you not know how to send an email from the script? If you know how to do that then that should be all you need to do
here is some skeleton code to get you started
PHP Code:
$usersEmails = mysql_query("select emails from table where ...... ");
$message = generateEmailMessage()
while ($row = mysql_fetch_row($usersEmails)) {
mail($row[0], 'Member of the Day', $message);
}
where generateEmailMessage() is the email message
now just have the cron run this script every night around 2:00am or so :cry:
I don't understand what your question is, do you not know how to randomly select a user from the database? do you not know how to send an email from the script? If you know how to do that then that should be all you need to do
here is some skeleton code to get you started
[PHP]$usersEmails = mysql_query("select emails from table where ...... ");
$message = generateEmailMessage()
while ($row = mysql_fetch_row($usersEmails)) {
mail($row[0], 'Member of the Day', $message);
}[/PHP]
where generateEmailMessage() is the email message
now just have the cron run this script every night around 2:00am or so