Current location: Hot Scripts Forums » Programming Languages » PHP » Auto Email Reminders


Auto Email Reminders

Reply
  #1 (permalink)  
Old 01-11-10, 04:54 AM
kavionly kavionly is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Auto Email Reminders

Hi,
How do i send an auto email reminders to specified email address at a certain date and time, date time and email from mysql database.

can anyone help me pls?

Thank You,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-11-10, 06:29 AM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
Here's a "quick and dirty" "text-only" emailer...
HTML and/or multi-part emails will take more work...

As far as the time and date, you can setup a cron job that runs the php script at the appropriate times. If there are datetime reminders on a "per email recipient" basis, you'd need 1 or more additional fields in the database to limit the sql selection on.

Code:
$db = mysql_connect('host','dbuser','dbpass');
mysql_select_db('some_database');
$sql = "SELECT name,email_addr from users";
$rs = mysql_query($sql);

while ($row = mysql_fetch_assoc($rs)) {
  $to =  "'" . $row['name'] . "' <" . $row['email_addr'] . ">";
  $subject = "RE: The subject";
  $message = "Your message goes here";
  $headers = 'From: info@mysite.com' . "\r\n" .
     'Reply-To: info@mysite.com' . "\r\n" .
     'X-Mailer: AnythingYouWant.0' ;

  // Assuming you have a properly setup mail connection at your hosting account
  $success = mail($to, $subject, $message, $headers);

  // Check $success and process accordingly
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Freeze columns in a table Rita Negi Script Requests 1 09-01-09 09:23 AM


All times are GMT -5. The time now is 03:03 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.