Jump to content

Send an email at a time


scottf

Recommended Posts

My goal is to send an email at the time indicated below. (Every weds at 12). Here is my current code:

<?php date_default_timezone_set('MST');$file = $_SERVER['DOCUMENT_ROOT'] . "/entries.txt"; //Path to your *.txt file$contents = file($file);$string = implode("", $contents);    $to = "april@coastalmountaincreative.com";$subject = "My subject";$txt = $string;$header = "From: scott@avvecc.com";  $d = date( "w");$h = date( "G"); if ($d == 3) {if ($h == 12) { mail($to,$subject,$txt,$header);file_put_contents("entries.txt", "");}} ?>

It works great, however if no one visits the page at 12 that day it never gets sent. How can I make it so it sends no matter what? Thanks.

Edited by scottf
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...