User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 375,214 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 2,278 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

PHP reminder E-mail - Cron job to run the script

Join Date: Sep 2005
Posts: 611
Reputation: digital-ether will become famous soon enough digital-ether will become famous soon enough 
Rep Power: 5
Solved Threads: 38
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Practically a Master Poster

Re: PHP reminder E-mail - Cron job to run the script

  #8  
May 18th, 2008
Originally Posted by oku View Post
Been lookin at that php mail function today - was able to send a simple email using the examples that are provided

still figuring out how to email results from my query to be sent via email

ive structured a script below - it doesnt work but you can see what i am after

<?php

$host = "localhost"; 
$user = "user_name"; 
$pass = "password"; 
$db = "domains";


mysql_connect($host,$user,$pass) or die("ERROR:".mysql_error());
mysql_select_db($db) or die("ERROR DB:".mysql_error()); 

$query="SELECT domain_name FROM domains WHERE exp_date > NOW()+7 ORDER BY domain_name ASC";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();


$i=0;
while ($i < $num) {

$id=mysql_result($result,$i,"id");
$domain_name=mysql_result($result,$i,"domain_name");
$company_name=mysql_result($result,$i,"company_name");
$simply_account=mysql_result($result,$i,"simply_account");
$notes=mysql_result($result,$i,"notes");
$exp_date=mysql_result($result,$i,"exp_date");



$to      = 'daniel.whiteside@googlemail.com';
$subject = 'Domain renewall reminder';
$message = '


The following domains will expire in 7 days

<BR><BR>

$domain_name - $company_name<BR>

<BR><BR>

Dont forget to renew!<BR><BR>

Domain Team


';
$headers = 'From: oku@sutsurikeru.net' . "\r\n" .
    'Reply-To: oku@sutsurikeru.net' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

Not sure where i am going wrong


try doing some dumps (var_dump or print_r) of your $message variable in the while loop to see if you're getting what you want.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
All times are GMT -4. The time now is 3:08 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC