
30/10/2015, 13:46
|
| | Fecha de Ingreso: noviembre-2004 Ubicación: NULL
Mensajes: 655
Antigüedad: 20 años, 3 meses Puntos: 6 | |
Respuesta: No envia el email por fecha Codigo reminder_add codigo que dices que hay IF y aqui no hay eso, y segun el for reminder_add
este mensaje de asunto deberia llegar ""Reminder System y no llega esto si no el otro codigo Código PHP: <?php
/* if($currentTime < $startTime || $currentTime > $endTime)
{
print('Not sending an email after hours.');
die();
}*/
?> Código PHP: <?php
include('database.inc.php'); // Our database connectivity file
// Values you need set
$number_of_days_before = 1;
$email = "[email protected]"; // Aqui el email
$reminder_details = "";
$todays_date = date( "Ymd" );
$year = substr($todays_date, 0, 4);
$month = substr($todays_date, 4, 2);
$date = substr($todays_date, 6, 2);
$trigger_date = date("Ymd", mktime (0,0,0,$month,$date-$number_of_days_before,$year));
$result = mysql_query( "SELECT * FROM reminder_events WHERE reminder_date <= $trigger_date ORDER BY reminder_date ASC" );
$nr = mysql_num_rows( $result );
while( $row = mysql_fetch_array( $result ) )
{
$year = substr($row["reminder_date"], 0, 4);
$month = substr($row["reminder_date"], 4, 2);
$date = substr($row["reminder_date"], 6, 2);
$reminder_date = date("M j, Y", mktime (0,0,0,$month,$date,$year));
$reminder_details .= "Event: ".$row["reminder_name"]."\n";
$reminder_details .= "Date: ".$reminder_date."\n";
$reminder_details .= $row["reminder_desc"]."\n\n";
}
mysql_free_result( $result );
if( !empty( $nr ) )
{
// Send out Reminder mail
$mailheader = "From: Reminder System <$email>\nX-Mailer: Reminder\nContent-Type: text/plain";
//mail("$email","Reminder","$reminder_details","$mailheader");
echo 'la respuesta de mail es '.mail("$email","Reminder","$reminder_details","$mailheader");
// Delete the sent reminders
mysql_query("DELETE FROM reminder_events WHERE reminder_date <= $trigger_date" );
}
?>
Codigo 2 que envia segun lo que comentas, y el mensaje que llega es de este codigo
supongo que esto funciona pero a mi no, Código PHP: <?php
// Set this to your timezone
date_default_timezone_set('America/New_York');
// Start at 8:00 AM (24-hour time)
$startTime = mktime(8, 0, 0);
// End at 5:00 PM (24-hour time)
$endTime = mktime(16, 0, 0);
$currentTime = time();
// Do not send the email if it is outside of the allowed hours
if($currentTime < $startTime || $currentTime > $endTime)
{
print('Not sending an email after hours.');
die();
}
// Get the current day of the week as an index (0=Sunday, 6=Saturday)
$dayOfWeek = date('w');
// Do not send the email on weekends
if($dayOfWeek == 0 || $dayOfWeek == 6)
{
print('Not sending an email on the weekends.');
die();
}
// Info of person to receive the tests
define('TO_EMAIL', '[email protected]');
define('TO_NAME', 'John Doe');
// Info of person sending the tests
define('FROM_EMAIL', '[email protected]');
define('FROM_NAME', 'Email Tester');
// Example: 8:00 am on 1 Nov 2010
$subject = 'Test: ' . date('g:i a \o\n j M Y');
$message = 'This email was automatically generated. Please send an email to [email protected] if you would like to disable these automated tests.';
$result = mail(TO_NAME . ' <' . TO_EMAIL . '>', $subject, $message, 'From: ' . FROM_NAME . ' <' . FROM_EMAIL . '>');
var_dump($result);
?> |