Page 1 of 1
Can I do this with PHP? (E-mail autoresponder)
Posted: Thu May 18, 2006 11:07 pm
by eysikal
I'd like to create a script that can respond to text messages sent from my mobil phone.
Maybe some of you are familiar with Google's SMS service. You can send a text message to 46645(GOOGL) with something like "weather los angeles, ca." Google responds with the weather info.
I'd like to do something similar if possible, but I'm having a hard time conceptualizing it.
I suppose I would need a script that is constantly checking for changes on the e-mail server. Once it dectects a new message, it would need to be smart enough to know if it was sent from my phone. Then I could do the proper processing and return the info.
I don't really have an idea of where to start on the code to detect an e-mail(text) message.
Any ideas/suggestions would be appreciated.
Posted: Fri May 19, 2006 12:07 am
by Burrito
you could certainly do that.
you would have to do as you suggested and create a cron to pop to a mail server (assuming you're set on using email) and then parse the message to determine how to respond.
after you've figured out how to respond, sending the email back to your phone is a snap.
Posted: Fri May 19, 2006 12:48 am
by eysikal
Burrito wrote:you could certainly do that.
you would have to do as you suggested and create a cron to pop to a mail server (assuming you're set on using email) and then parse the message to determine how to respond.
after you've figured out how to respond, sending the email back to your phone is a snap.
Ok what is a "cron?"
I think I can figure out the parsing of the message and all that. It's just the detecting of the message that I am stuck on. Not sure where to start on that.
Posted: Fri May 19, 2006 3:27 pm
by eysikal
I guess I'll try to go figure it out. But some direction would be nice.
Posted: Fri May 19, 2006 3:31 pm
by Chris Corbyn
eysikal wrote:I guess I'll try to go figure it out. But some direction would be nice.
CRON is task-scheduler for linux (but better

).
Assuming you can get your SMS to foward to an email inbox the next things sou'll want to look at are:
IMAP Functions (used for POP3 and NNTP too)
Posted: Fri May 19, 2006 3:42 pm
by eysikal
d11wtq wrote:eysikal wrote:I guess I'll try to go figure it out. But some direction would be nice.
CRON is task-scheduler for linux (but better

).
Assuming you can get your SMS to foward to an email inbox the next things sou'll want to look at are:
IMAP Functions (used for POP3 and NNTP too)
Well text messages work like e-mail. You can send a message like this "
1234567891@tmomail.net" and it will be received like a text message.
But I don't know how I am going to send one from my phone. Haha, guess I should have thought about that.
Any ideas?
Posted: Fri May 19, 2006 3:46 pm
by Burrito
I hope that's not your phone number... I've removed it just in case

Posted: Fri May 19, 2006 3:47 pm
by eysikal
Burrito wrote:I hope that's not your phone number... I've removed it just in case

Haha, no it's not. I'm not that dumb.
Posted: Fri May 19, 2006 4:14 pm
by eysikal
Well I'm starting to think there's no way to do this. Unless I can somehow forward messages sent to my phone number to another e-mail address. Or do you think I would be able to monitor T-mobile's e-mail server?
Posted: Fri May 19, 2006 4:19 pm
by Chris Corbyn
eysikal wrote:Well I'm starting to think there's no way to do this. Unless I can somehow forward messages sent to my phone number to another e-mail address. Or do you think I would be able to monitor T-mobile's e-mail server?
Excuse my ignorance here... in the UK SMS messages from mobile phones have nothing at all to do with email (been discussed here before). When the messages sent to your email address reaches your cell phone does it also get copied to your email inbox with your service provider (T-Mobile?). In which case, you would have a login username/password for that email address and hence, you can use PHP with the IMAP functions above to check for new messages.
Posted: Fri May 19, 2006 4:39 pm
by eysikal
I'm not sure. All I know is that sending a e-mail to a number like
1234567890@tmomail.net will end up the phone with that number. I'm doing some research right now to try to figure this all out.
Posted: Fri May 19, 2006 9:32 pm
by timvw
Basically you have two problems:
(1) Fetching and analyzing e-mail messages and finding out where it came from (sms provider) and the eventual body...
(2) Sending back an e-mail with the wanted answer...
I prefer to use fetchmail and procmail for (1) and phpmailer for (2).
Posted: Sat May 20, 2006 12:02 am
by eysikal
timvw wrote:Basically you have two problems:
(1) Fetching and analyzing e-mail messages and finding out where it came from (sms provider) and the eventual body...
(2) Sending back an e-mail with the wanted answer...
I prefer to use fetchmail and procmail for (1) and phpmailer for (2).
Shoot, unfortunately I'm not running linux. Maybe I should set a partition and load it up.
Posted: Sat May 20, 2006 4:01 am
by timvw
Apparently all these tools are available for Win32 too... And i suppose Cygwin has them too..