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 397,625 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,430 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: May 2008
Posts: 9
Reputation: oku is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
oku oku is offline Offline
Newbie Poster

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

  #7  
May 11th, 2008
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
Reply With Quote  
All times are GMT -4. The time now is 9:05 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC