Can I do this with PHP? (E-mail autoresponder)
Moderator: General Moderators
Can I do this with PHP? (E-mail autoresponder)
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.
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.
Ok what is a "cron?"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.
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.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
CRON is task-scheduler for linux (but bettereysikal wrote:I guess I'll try to go figure it out. But some direction would be nice.
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.d11wtq wrote:CRON is task-scheduler for linux (but bettereysikal wrote:I guess I'll try to go figure it out. But some direction would be nice.).
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)
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?
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
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.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?
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.
Shoot, unfortunately I'm not running linux. Maybe I should set a partition and load it up.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).