hoolahoops Posted May 16, 2010 Share Posted May 16, 2010 hi there i was refered here from yahoo answers because of the question im trying to find the answer to and i dont know if this is the right forum for this but oh well lol... i'm using a shared hosting account running sendmail and i have access to a plesk control panel. I'm trying to make it so i can forward emails from an inbox on an email account (lets say email@example.com for an example) and when they are recieved they are forwarded to a PHP script which will run what i want the PHP script to do (generate a random number and send it back (pointless yup but part of a test for a future program im making)) any ideas how i can do this? thanks in advance =D Quote Link to comment https://forums.phpfreaks.com/topic/201969-how-can-i-forward-emails-to-php-script-on-shared-hosting-account/ Share on other sites More sharing options...
trq Posted May 17, 2010 Share Posted May 17, 2010 You could quite easily have a php script execute every 5 minutes or so via cron. This script would then check your desired mail account for new mail using the imap extension and when found take the appropriate action (including replying to the email if required). Quote Link to comment https://forums.phpfreaks.com/topic/201969-how-can-i-forward-emails-to-php-script-on-shared-hosting-account/#findComment-1059325 Share on other sites More sharing options...
hoolahoops Posted May 17, 2010 Author Share Posted May 17, 2010 thanks for the reply the reason i need it to act like a trigger as described is because its for a text-based roulette script im making (SMS text messages) and i'm trying to setup an email version as a testing grounds. I wll port accross to the SMS messages later. thanks in advance =D Quote Link to comment https://forums.phpfreaks.com/topic/201969-how-can-i-forward-emails-to-php-script-on-shared-hosting-account/#findComment-1059594 Share on other sites More sharing options...
trq Posted May 17, 2010 Share Posted May 17, 2010 If you had your own server (or even a vps) you would have more options such as incron which can execute scripts when changes are made to directories. But without more control of the server yuor pretty limited in what you can do. Quote Link to comment https://forums.phpfreaks.com/topic/201969-how-can-i-forward-emails-to-php-script-on-shared-hosting-account/#findComment-1059777 Share on other sites More sharing options...
DavidAM Posted May 18, 2010 Share Posted May 18, 2010 I did this on my development system once. Basically, you put a .forward file in your home directory which contains a pipeline that receives the email on stdin. I don't know if there are any hosting providers that support this. All I can say is that it can be done on a linux system. Talk to technical support at your webhost and see if they will. Quote Link to comment https://forums.phpfreaks.com/topic/201969-how-can-i-forward-emails-to-php-script-on-shared-hosting-account/#findComment-1059897 Share on other sites More sharing options...
hoolahoops Posted May 18, 2010 Author Share Posted May 18, 2010 thanks for the replies and help guys I had a word with my host and they said they don't support the .forward file because they dont allow users to upload to their home directory only the folders that can be seen on the internet (so httpdocs and httpddocs in my case) I setup a VMware centOS 5 server for development and it works great with the forward file. Thanks again =D Quote Link to comment https://forums.phpfreaks.com/topic/201969-how-can-i-forward-emails-to-php-script-on-shared-hosting-account/#findComment-1059965 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.