Jump to content

how can i forward emails to PHP script on shared hosting account?


hoolahoops

Recommended Posts

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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.