| | |
help sending email at a future date using php
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2008
Posts: 35
Reputation:
Solved Threads: 0
hi, i'm a newbie to php and i'm building a website right now. i giving the users the option to create and send
news letters. i also want to give them the option of sending the newsletters at a later date i.e they can create the newsletters, choose a date and time they would like to have it sent, and then save it, so that at the said time, the mail would be automatically sent.
can anyone help me out with this?
i heard about cron, but it seems its just for unix users and it seems kind of complicated. does anyone have a simpler/better alternative?
news letters. i also want to give them the option of sending the newsletters at a later date i.e they can create the newsletters, choose a date and time they would like to have it sent, and then save it, so that at the said time, the mail would be automatically sent.
can anyone help me out with this?
i heard about cron, but it seems its just for unix users and it seems kind of complicated. does anyone have a simpler/better alternative?
•
•
Join Date: Jul 2008
Posts: 148
Reputation:
Solved Threads: 25
unless your site has a constant consistent flow of traffic, cron (nix) / Task Scheduler (windows) would be the only way to accurately do this.
On windows you would need to use the task scheduler. http://www.sugarcrm.com/wiki/index.p...ux_or_Mac_OS_X
This is specific to SugarCRM's setup, but the concept is really easy and you should be able to figure it out.
On windows you would need to use the task scheduler. http://www.sugarcrm.com/wiki/index.p...ux_or_Mac_OS_X
This is specific to SugarCRM's setup, but the concept is really easy and you should be able to figure it out.
php Syntax (Toggle Plain Text)
<?php if (date('j, n, Y') == '10, 3, 2009') { mail('mail@example.com', 'Subject', 'Message'); } ?>
Ive not tested it but it should work
Last edited by !Unreal; Jan 9th, 2009 at 7:49 am.
•
•
Join Date: Jul 2008
Posts: 148
Reputation:
Solved Threads: 25
That is a perfectly fine solution, but unless there is someone visiting that page on that date at a certain time, there is no way to force it to be sent:
With cron or task scheduler this is avoided.
Just call a script that calls up all the pending emails and sends anything older than the current time.
Depending on how frequently cron is running, every minute, every 10 minutes, etc would be the longest a user would have to wait for their email to get picked up by the system.
- user creates the email
- user schedules it for 01/10/2009 @ 15:00:00
- user exits
- no new visitors till 01/13/2009
- email doesnt send till earliest 01/13/2009
With cron or task scheduler this is avoided.
Just call a script that calls up all the pending emails and sends anything older than the current time.
Depending on how frequently cron is running, every minute, every 10 minutes, etc would be the longest a user would have to wait for their email to get picked up by the system.
![]() |
Similar Threads
- How to configure GD (PHP)
Other Threads in the PHP Forum
- Previous Thread: How do I display comments on a webpage?
- Next Thread: Php file upload
| Thread Tools | Search this Thread |
ajax apache api array arrays beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external file files folder form forms forum function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert integration ip java javascript joomla limit link login loop mail malfunction menu method mlm multiple mysql neutrality oop paypal pdf php phpmysql play problem query question radio random recursion regex remote root script search select server sessions sms soap source space sql syntax system table tutorial update upload url validator variable video web xml youtube





