Jump to content

Recommended Posts

Hi

 

I need some help. I want to send an email to user to inform them about their next appointment date but I don't know how to do the query.

My database look something like this:

id    |  name    |  email    |  contact_no    |  appointment_date

1        Jon            jon@abc.com    12345678      24/12/2011

The appointment date is added in by user so it will keep updating to the latest date.

 

<?php

include 'config.php';

 

$sql = executeSelectQuery($MYSQL);

 

if($sql){

$to = $_POST ['email'];

$subject = "Appointment Date";

$message = "Hello! Please be informed that your next appointment is on $appointment_date";

$from = "123@abc.com";

$headers = "From: $from";

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

 

if ($sent){

    $statusMessage = "Mail Successfully Sent.";

}else{

    $statusMessage = "Mail Unsuccessfully Sent";

}

 

?>

 

Please kindly help.

 

Thanks

Ben

Link to comment
https://forums.phpfreaks.com/topic/251682-php-query-for-sending-email/
Share on other sites

add this headers

$headers = "MIME-Version: 1.0\r\n";

$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";

$headers.= "From: $from\r\n";

 

 

You didn't even read the question, did you?

benchew0904, whomever assigned this, probably wanted you to send the reminder email once, a specific number of days ahead of when the appointment is scheduled?

 

Also, your appointment_date column needs to be a mysql DATE data type so that you can perform the date check in the query. The 24/12/2011 format cannot be directly used by mysql.

 

Edit: Also, if for some reason your code doesn't send out a reminder at the intended time (your code didn't run for some reason, email could not be sent for some reason, ...), what do you want to do? Keep trying and for how long?

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.