I'm a beginner in php and I want to know if there is a way to send out an email with delay. I want to build a website where users can send an email to themselves with their goals and predictions, and after one year, they should receive their own email automatically.
Does anyone has an idea how I could do this?
You will have to take a look at CRON Jobs. CRON Jobs can be set to run at certain intervals. Hourly, Daily ect.
Here is a link to a tutorial.
You would need to store the email inside of a database or something.
Then you would need code that either auto starts 15 minutes after a new row has been added, or you would need code to check through the database for any unsent mail every few minutes. Usually "cron" is used for this.
Related
I'm making a database for labors resident Visa, I want to make a reminder on expiry date, if a visa expire at 1/1/2012, I Want PHP to send me reminder as email, or pop up message
EDIT
thank you guys, but let's forget about the reminder via email, let's say I created a table (ID,name,issue date,expiry date) (1,joe,11/11/2009,12/11/2011) and all data are displayed in a table.. what I want to do is, I want the color of the table row to turn red in case its expired.
I hope I explained it right..
create a page to check the expiry date and do necessary action. set a cron job to call the page every one hour or a time suitable for you.
Search for cron job and how to setup it in your control panel using your search engine
Run a cron job every day to fetch the list of visas expiring on specific date, and send a mail to all the results.
More info about cron
http://www.sitepoint.com/introducing-cron/
Check this url which could be the basis of your script, and easily merged. http://www.devarticles.com/c/a/MySQL/Setup-Your-Personal-Reminder-System-Using-PHP/1/
You need to write the cronjob .. that make an email to you after a specific time
You can read more about cronjob from here ...
cronjob
Sandeep and Joby provided your solution. I would like to add this as another suggestion.
Use cron job to schedule a process that will check for visas expiring everyday. Then send an email appropriately.
To send an email easily, you can use PHPMailer library. It has a lot of built-in facility which are ready for use.
I am working on a web-application to make an SMS Reminder service, which takes various inputs from the user, like the user's name, his number, and the time he wants the reminder. The reminder is then sent through an SMS. I have the SMS Gateway part figured out for which I am using Zeep Mobile's API. I wanted to know how I can send an SMS on the time input by the user.
The database would have the user-id and the time, and I need to get my application to send an sms at the time. Any tutorials on similar lines would be great help.
Thanks in advance
Let's say your reminder interval is 1 minute and you are deploying on Linux.
1) Set up a cron-job to check your database every minute for possible reminders
2) If there are reminders to be sent, execute your sending script.
3) Mark sent reminders with a status (or similar) so you don't send them again.
Depending on what server your application is deployed, you would need to run some kind of service that would run continuously and send SMS whenever one is due.
One note though, since repeated database access is costly, you may like to load up Reminders that would need to be sent in a short time. The database should be accesses periodically with a reasonable time interval.
HI all,
I have an account in getresponse.com
I want to send emails to the members in my mailing list after one hour of their joining.
Please tell me how can i do this
I don't really know what's that getresponse.com all about and what are your possibilities, but deducing from php tag:
Php scripts can't execute for an hour => you have to schedule this. You need some database(or at least a file or sth else) to store the information when someone joined and a cron script that's scheduled to run eg. every 5 minutes that checks your database and if the time is right sends an e-mail and then removes the entry from database.
Admin interface allows you to create a follow-up message received by subscriber no sooner than 1 day after their subscription, so you will most likely have to send it through their API call:
http://dev.getresponse.com/api-doc/#send_newsletter
i have a program which use to send group emails, i set a cornjob per mins for this program, and set execute per 2nd/min, and check if the now time is match to my defined schedule time in db. if true the program will run and send email, else nth...
the problem is i want to dynamic set the amount of email sending per mins by user, let say i have 10000 emails to send, and i want to send 3 emails per min, something like that, but i cant find the way when using cronJob, (set cookie? record the current email to db?),
since i found that if i use sleep(), it will cause php execute limit error...
Can anyone tell me how to do that?
or using other method to do schedule task? pear?
if using other methods, can show how to use it briefly ?
Please And Thx
First of all. 10000 emails with 3 per minute will take over 2 days.
Secondly, the best way to do this is to save the emails to database (to, title, body etc) and then create a script that sends out 3 emails and set the cronjob to run every minute.
Also check out these questions.
Sending bulk email in PHP
Sending mass email using php
Best way to send 10,000+ emails with PEAR/Mail_Queue
I think you should set this configuration at the application level rather than the cron job level.
Let's say, cron job should run every minute but the application itself should know howmany e-mails to send when a cron job runs by checking the datetime for the last e-mail is sent, and let's say, send 3 more e-mails and so.
its only example to said 3 emails per mins
actually i want to give user to set the amount of sending email per min/ per hour/ per second
and i know about the send email program, but what if mutil task doing..
such as 3 newsletter will blast at 20/3/2009 15:15:00; each of those target to 10000pls
i dun want to save the whole blast list in db, since client may import a email list for 40000 ppls, always timeout when import, even i set the time limit to 2 mins, dun want to take more then that time
so do u have any sugeestion on the email sending?
I want to send emails through a web app, for example, reminders of a tasks manager, reminders of birthdays... I want to program a date and an hour, and get the email sent at that moment.
I think I have two options to do this: using cron or sending email with a future timestamp.
Using cron involve to run a command (which will query the database) each one, two o five minutes to check if there are any email to be sent. Or, another way, when I save a new reminder, put a new crontab task (via execute a system command from the web app) at the time indicated. With the first option, I think the server load will be excessive. With second option, I'll have hundreds of crontab tasks, what looks dirty for me.
Perhaps I could send the email at the very moment of creating the reminder, but changing the email timestamp to a date and hour in the future. I know some email servers can manage this (like Mercur for Windows), but, is it a standard? I will use my Gmail account to do this job. And, with this solution, I won't be able to cancel a reminder, because the email has been sent at the moment I created the reminder.
I can use PHP or Ruby (RoR) for server language, so the language isn't important, because both of them can send emails and call system commands. If the solution entails scripting, I can use bash scripts, Perl, Python... (the server is a Linux box).
Which do you think is the best method to accomplish the solution to this problem?
I apologize for my poor english. Thanks in advance.
I don't know if you've looked into this, but since you use GMail I thought you might be interested. Google Calendar has this feature:
Go into GMail.
At the top, click on "Calendar".
On the left is a list of calendars. Each has a small link called "Settings". Follow this link (you may want to create a new calendar for this project).
This brings up a tabbed interface. I think it always brings you to the "Calendars" tab, but if it doesn't, click that tab.
Each of the calendars will have a link next to it called, "Notifications". Click the link for the calendar you want to notify you.
This will bring up a list of settings which you can use to set up notifications by sending an email.
Google's API should allow you to access the calendar to sync it with your application. If it's set to send you an email, it will handle all the email for you.
instead of having a cron job for each reminder (or notification, whatever), you might write everything in a file and periodically (for example every 5 minutes) call a script (e.g. php-script) that reads the file and checks whether to send a notification or not...
you would have the functionality without needing to create a cron-job for every item...
would that be a solution?
regards
Having a cron is a better option then sending out emails with future date stamp. Set a cron to run on periodically and it can send out emails.
We have similar questions.
Sending mass email using PHP
https://stackoverflow.com/questions/215736/how-do-i-send-bulk-mail-to-my-users-in-a-generic-fashion
Read those you will get some ideas.