Jump to content

Recommended Posts

Basically it is..

I have a Admin page- > In this the admin wil be able to create a user by entering in his particulars:

eg: user name, password for the user, telephone and email address..

The user will able to login using this username and password. Once they log in, they see a form which has to be filled in by them,,..once they submit the form, the form details is passed on to the admin..If the user has sumitted the form, then its completed..

 

 

What i need is an Auto reminder for the users to remind them to fill in the report form and send it.. the email address is taken from the user table, that the admin has created...

 

eg: lets say the user has to submit the report on march

Then an auto reminder has to be sent on Feb 1st. If the user has not yet submitted the form, a 2nd auto reminder must be sent on Feb 7th. if again he hasnt submitted then another auto reminder has to be sent on Feb 21st..

So, total 3 auto reminders upon checking of conditions,....If the user has submitted the report no need to send auto reminders.

 

The server has to run the php script on its own..

I think this is done using CRONJOB in the cpanel..But i dont have any idea on it,,,I read through many resources, but coudnt get any idea... Can someone help..I need this immediately..

Ur help is much appreciated...

Thanks again..

Link to comment
https://forums.phpfreaks.com/topic/192355-auto-email-reminder-upon-conditions/
Share on other sites

You need to post your actual problematic code then and a description of your problem. As for cron, it really is a Linux question, not related to php. I see you use Cpanel though, it should be pretty straight forward to setup cron to execute a given script at a given time.

<?php

$con = mysql_connect("localhost","root","");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }

 

mysql_select_db("db", $con);

 

$sql = "SELECT c_name, c_email FROM company_creator";

$result = mysql_query($sql);

 

while ($row = mysql_fetch_assoc($result)) {

  $to =  "'" . $row['c_name'] . "' <" . $row['c_email'] . ">";

  $subject = "RE: The subject";

  $message = "Your message goes here";

  $headers = 'From: noreply@gmail.com' . "\r\n" .

    'Reply-To: noreply@gmail.com' . "\r\n" .

    'X-Mailer: AnythingYouWant.0' ;

  $success = mail($to,$subject,$message,$headers);

}

?>

 

It gives me error in here -- > $success = mail($to,$subject,$message,$headers);

Failed to connet to mail server, verify your SMTP and smtp_port

I am using a localhost.. how to set the mail server..

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.