Hello, all.
I am developing a simple iOS/Android app that sends reminders as emailed SMS based on user preferences.
Is it possible to have the app "post" to a LC page which sends a precomposed message at a time in the future (say 45 minutes from the time it was posted)?
I currently host with On-Rev, but have no idea how to accomplish this, if it's possible.
Can anyone help guide me?
Many thanks!
:Todd
Sending email in time...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 243
- Joined: Sun Dec 06, 2009 12:24 am
- Location: Fredericktown, MO
- Contact:
Re: Sending email in time...
Either this is so simple I should be chastised for asking, or it's impossible, eh?
Anyone out there?
:Todd
PS. Klaus, thanks for cleaning up the spam... it is appreciated
Anyone out there?
:Todd
PS. Klaus, thanks for cleaning up the spam... it is appreciated
Re: Sending email in time...
ctflatt wrote:Hello, all.
I am developing a simple iOS/Android app that sends reminders as emailed SMS based on user preferences.
Is it possible to have the app "post" to a LC page which sends a precomposed message at a time in the future (say 45 minutes from the time it was posted)?
I currently host with On-Rev, but have no idea how to accomplish this, if it's possible.
TO POST
-that's the easy part.
in your app, you put the address email for instance into leMessage. Then :
Code: Select all
put "tobeanalysed="&urlencode(leMessage) into leMessage
post leMessage to url "http://www.mysite.com/backoffice.irev
Code: Select all
<?rev
put $_POST["tobeanalysed"] into leMessage
TIME
-that's the tricky part from my point of view.
The only solution would be to create a "cron job"... that would execute a every XX minutes a .irev script that would read from the MySQL DB, looking for an email address.. and then sending the email, and then deleting etc.
-
- VIP Livecode Opensource Backer
- Posts: 243
- Joined: Sun Dec 06, 2009 12:24 am
- Location: Fredericktown, MO
- Contact:
Re: Sending email in time...
bangkok:
Thank you so much for responding! I really appreciate it.
I read and understand your example, but here is the twist... I do not want to "collect" email and send once every 45 minutes, but rather when the app posts to the page, each post is sent 45 minutes later. Does that make sense?
Is this possible:
IN THE APP
IN THE BACKOFFICE.LC FILE
Is this viable, or is this too taxing of the server? Should this work?
Thanks!
Thank you so much for responding! I really appreciate it.
I read and understand your example, but here is the twist... I do not want to "collect" email and send once every 45 minutes, but rather when the app posts to the page, each post is sent 45 minutes later. Does that make sense?
Is this possible:
IN THE APP
Code: Select all
put "tobeanalysed="&urlencode(tMessage) into tMessage
post tMessage to url "http://www.somesite.com/backoffice.lc"
Code: Select all
<?lc
put $_POST["tobeanalysed"] into tMessage
--45 minutes, converted to seconds
wait 2700 seconds with messages
post tMessage to url "http://www.somesite.com/sendmail.php"
?>
Thanks!
Re: Sending email in time...
Ok i understand.
From my experience you can not use the form "wait for XX minutes" within a irev script.
This is why, i thought about the cron job.
Regarding your rule 45 mn after post, there is I think a turn around :
-when you receive the post, you calculate the current time + 45 mn. You write this value into the database, along with the email text to be sent.
-after that, let's say your cron job launches the second irev script every minute. Within the script, you are going to look into the database for an email with a time = + or - 1 minute compared to the current time (AKA the time when the cron job is executed).
-you send the email, then you delete it or them from the DB.
You see ?
There might be other solutions, but that's the only one i can think of.
From my experience you can not use the form "wait for XX minutes" within a irev script.
This is why, i thought about the cron job.
Regarding your rule 45 mn after post, there is I think a turn around :
-when you receive the post, you calculate the current time + 45 mn. You write this value into the database, along with the email text to be sent.
-after that, let's say your cron job launches the second irev script every minute. Within the script, you are going to look into the database for an email with a time = + or - 1 minute compared to the current time (AKA the time when the cron job is executed).
-you send the email, then you delete it or them from the DB.
You see ?
There might be other solutions, but that's the only one i can think of.