Trying to make an SMS Reminder Application - php

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.

Related

Send a campaign more than once in MailChimp

I am trying to send an email to users based on their status. The first email needs to be sent after 2 hours, and a second one after 24 hours.
I am running a PHP script that checks for users who belong to a state and I sent the first email to them using the send API call, the problem now, is that when the script runs again (a crobtab that runs every 20 mins), I cannot send the campaign again since apparently you can send a campaign only once.
I am putting the cid directly in my PHP code, so I cannot go and edit the code everytime I want to run the crontab!
Do I have to use the campaigncreate()method everytime the crontab runs?
https://apidocs.mailchimp.com/api/2.0/campaigns/create.php
It would be better if there is an easier way, since an account cannot have more than 32,000 campaigns.
Mailchimp is a bulk email service and isn't designed to send transactional emails.
You should instead try to use Mandrill, a transactional email service built by the same company. And their API is quite simple to use.
Then, you can indeed run your PHP script every hour (or x minutes) to send emails based on user status.

How to send email in accordance with the time we set in PHP

i want to ask something.
Maybe I will explain the scenario first :
When someone buy an item from my online shop and then they checkout, I send them email about what they buy.
After 1 hour they buy, i want to make some notification for them using email and send to them they must confirm the payment and every 3 hour the same email will be send to them and that email will be send just 3 time in one day. Example: they buy some item at 12.00, at 13.00
the system will automatically send notification to them to confirm the payment,at 16.00 and 19.00 system will send the same email notification again.
If in one day they don't confirm the payment, system not send the notification again and cancel the order or if they already confirm the payment before deadline, system not send the notification again.
How can i achieve the solution for a question 2 and 3?
Thank you so much for your response and solution..
If your xampp is on Windows, you can use windows-schedulers to call a particular script (PHP script in your case, preferably by an URL), which checks the birthdays of all the users and sends them mail accordingly.
If your xampp is on Linux/Unix/etc, you can use cron-jobs, and rest is same!
There is also a third way, a third-party scheduler or say online-cron, which will remotely call yours script (php-page).
**Example:**
If you are doing the cron-settings of OS yourself, you can still let the configure as to whom to email in your system, rather than OS.
Now regarding the time settings, you can make the CRON call your script every our, and you php script will check the appropriate time, and fire the mails!
Refrence Send mail to different customer on their birthday

Sending daily SMS a specific time

I am working on a site that allows users to enter their phone number and carrier, and choose a time to receive a daily alert via SMS.
I am inserting information (phone number, carrier, and time) into an SQL database, then using php's mail() function to send SMS texts to their phone by email (i.e. if a Verizon user's number is 123456789, I would send an SMS by emailing to 123456789#vtext.com).
I cannot figure out how to send the SMS every day repeatedly, as well as how to send it at the specific time the user selects. What approach could I take to do this?
You need to use some scheduler application like "cron" in Unix machines or "Scheduled Tasks" in Windows machines. Use one of those apps to schedule a job for execute a php file at the time and day pattern you want.
You either have to have an SMS Gateway (hardware) or use some other service to do so.
For example:
http://www.sms4pc.com/api-start?gclid=CKei9Yr_7qwCFRLatgodGyNJKQ

How to send email after one hour of the joining in getresponse.com

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

Best method to send programmed emails from web application

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.

Categories