•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,712 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 3,427 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: 2752 | Replies: 3
![]() |
•
•
Join Date: Feb 2006
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
On a site I'm building, on the first page there is a "Featured Member Of The Day!" This is set up through a php script to randomly selects a new member business every 24 hours from the MySQL DB... We've got this all working with the MySQL DB and the tables we've set up. Here's my problem or question......
I would like to automatically have the same "featured Business of the day" notified by an email that they are that day's featured business! This needs to be automatic and happen at the start of each day exactly when they are made that day's featured business!...
Though I have been told that this can be "easily" done, I have not been able to find anything or scripts that would enable this. Any Help there???
Some sites are suggesting "CRON" and say it's installed on most Linux servers, and my host server has a version of that, but I am still at a loss for the php script.
I have missed my deadline for this client for yesterday already... So any help or direction you could point me in would be greatly appreciated!!!!!
Please send your reply to my email address link.
Thanks,
Kent
I would like to automatically have the same "featured Business of the day" notified by an email that they are that day's featured business! This needs to be automatic and happen at the start of each day exactly when they are made that day's featured business!...
Though I have been told that this can be "easily" done, I have not been able to find anything or scripts that would enable this. Any Help there???
Some sites are suggesting "CRON" and say it's installed on most Linux servers, and my host server has a version of that, but I am still at a loss for the php script.
I have missed my deadline for this client for yesterday already... So any help or direction you could point me in would be greatly appreciated!!!!!
Please send your reply to my email address link.
Thanks,
Kent
•
•
Join Date: Oct 2004
Location: San Francisco, CA
Posts: 337
Reputation:
Rep Power: 4
Solved Threads: 1
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
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
•
•
Join Date: Feb 2006
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
: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 support@example.com.
Any ideas????
Kentf
kent@via-media.com
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:
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 support@example.com.
Any ideas????
Kentf
kent@via-media.com
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:
•
•
•
•
Originally Posted by paradox814
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
•
•
Join Date: Oct 2004
Location: San Francisco, CA
Posts: 337
Reputation:
Rep Power: 4
Solved Threads: 1
you need to set the headers....
[php]$sender_name = "Your Email Name";
$sender_email = "Your Email Address";
$headers .= "From: ".$sender_name." <".$sender_email.">\r\n";
$headers .= "Reply-To: <".$sender_email.">\r\n";
$headers .= "Return-Path: <".$sender_email.">\r\n"; [/php]
after doing that, change[php]mail($row[0], 'Member of the Day', $message); [/php] to [php]mail($row[0], 'Member of the Day', $message, $headers); [/php] hope this works!
[php]$sender_name = "Your Email Name";
$sender_email = "Your Email Address";
$headers .= "From: ".$sender_name." <".$sender_email.">\r\n";
$headers .= "Reply-To: <".$sender_email.">\r\n";
$headers .= "Return-Path: <".$sender_email.">\r\n"; [/php]
after doing that, change[php]mail($row[0], 'Member of the Day', $message); [/php] to [php]mail($row[0], 'Member of the Day', $message, $headers); [/php] hope this works!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
advertisment badge blog browser building cell community competition daniweb email encryption eu eudora firefox gentoo gmail google imap linux member microsoft mobile mozilla news onecare open source opinion outlook penelope phishing phones php professional research scam security spam spammers spamming stocks technology thunderbird virus web webmail
- How to send email from flash8..using php or asp (Graphics and Multimedia)
- Newbie php question. how to create a mailing list? (MySQL)
- PHP - subscribers' email (PHP)
- send email with attachment (PHP)
- how to hide email recipient list (PHP)
- Please help with email form script (PHP)
Other Threads in the PHP Forum
- Previous Thread: Hi I've been told by my bf that php and mysql are very very powerful tools in the com
- Next Thread: Apache


Linear Mode