944,179 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 12040
  • PHP RSS
Nov 2nd, 2006
0

Automatic email

Expand Post »
Id like to generate an automatic email at certain times of the week from my website to certain users. i.e at 12.30 on wednesday id like an email reminder sent to user example@example.com. Can anyone point me in the right direction
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
solomonski is offline Offline
24 posts
since Sep 2006
Nov 2nd, 2006
0

Re: Automatic email

you need to set up a cron job (or crontab), make sure your webserver allows you to run a cron job, if so look in your control panel for how to set it up, if it's not in there then log in via SSH and type "man cron" to get the man pages. Crons can be difficult to set up so try searching the web for some tutorials or asking in the linux forums for how to set up this particular cron job

Click to Expand / Collapse  Quote originally posted by solomonski ...
Id like to generate an automatic email at certain times of the week from my website to certain users. i.e at 12.30 on wednesday id like an email reminder sent to user example@example.com. Can anyone point me in the right direction
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004
Nov 2nd, 2006
0

Re: Automatic email

Sorry i didnt mention that the website sits on a windows platform machine.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
solomonski is offline Offline
24 posts
since Sep 2006
Nov 3rd, 2006
0

Re: Automatic email

Click to Expand / Collapse  Quote originally posted by solomonski ...
Sorry i didnt mention that the website sits on a windows platform machine.
The windows scheduled tasks manager works the same as cron. You can set up the task to run your php script.

If you want a purely web based solution take a look at this article in my blog: http://fijiwebdesign.com/content/view/86/77/

You could use the method mentioned there, with a bit of php like:

pseudo code:

[PHP]$query = "select from my_tasks where time < time() and complete = false".
$uncomplete_tasks = query($query);

foreach ( $uncomplete_tasks as $task) {

// carry out task
// for example if you list php scripts to run.. do something like
exec("wget http://example.com/$task.php");
// then update the database, task success, or fail etc.

}[/PHP]
Last edited by digital-ether; Nov 3rd, 2006 at 4:45 am. Reason: typo
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005
Nov 10th, 2006
0

Re: Automatic email

Many thanks for that
Reputation Points: 10
Solved Threads: 0
Newbie Poster
solomonski is offline Offline
24 posts
since Sep 2006
Apr 28th, 2010
0

Automatic BDay email script

I checked out your exec and html solutions, but neither one fit my needs.
I want to implement a distributed script that will send a BirthDay Greeting, automatically, at specific times of the day (midnight, of course). As described here, basically, this is the definition of a cronjob. But you can't distribute a software that will automatically setup a cronjob for the enduser's website, so it's out of discution.
Of course, it can be purely programmed in php/mysql/javascript, if we'd be sure there would be at least one visitor on a specific page that, by loading, would trigger the script for sending the email/emails at that moment in time.
Unfortunatelly, this is only a matter of pure luck!

I would consider the worst case, no one is visiting the website for one entire week (hypothetically).

How can we tell the website hosting server to run a script, as the cronjobs do, without using the cron system?

Is there any alternative to that? (javascript was the first thing that came to my mind, being a server-side language, but i'm not so sure it would work without a client browser triggering...)

What are your ideas/expertise about this? Could it be done? (on any linux/mac/windows servers, of course).
Thanks for your tutorials.
Last edited by ciprianmp; Apr 28th, 2010 at 10:42 am. Reason: typos
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ciprianmp is offline Offline
1 posts
since Apr 2010
Jul 19th, 2010
0
Re: Automatic email
If you don't have cron, then you need a client process to trigger.
You could have a php / javascript reloading page which at a certain time processes the list. You would need a browser running somewhere. This is not necessarily a bad thing as it could act as a status page too.
If you are interested in pursuing this further, I'd be happy to assist you.
regards
Last edited by Ezzaral; Jul 20th, 2010 at 1:51 pm. Reason: Snipped email. Please keep it on site.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
marknhopgood is offline Offline
1 posts
since Jul 2010
Jun 7th, 2011
0
Re: Automatic email
I'm not sure if this would work, but try

PHP Syntax (Toggle Plain Text)
  1. <?php
  2.  
  3. $now = time();
  4. $original_tz = $_ENV["TZ"];
  5.  
  6. putenv("TZ=US/eastern");
  7. if (Date("h:m", $now) == 12:30);
  8. {
  9. mail(me@example.com, "subject", "MESSAGE");
  10. }
  11.  
  12. ?>
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
calebcook is offline Offline
65 posts
since Jun 2011

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Check Flash Player Is Installed?
Next Thread in PHP Forum Timeline: error in your SQL syntax; check the manual





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC