473,412 Members | 2,067 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

email activating a web page impossible?

Is it possible to somehow activate a page containing a php script by sending
an email to a mailbox on the server?
I have a script that sends out notification emails to an individual. He
wants to receive them continuously until he decides he has seen enough of
them. Then to stop receiving the emails he has to use his browser and go to
the web page that is sending him the emails where he clicks a button.
Would it be possible to arrange things in some way so that all he has to do
is fire off a reply to the most recent email he has received to activate the
script that stops the emails being sent.
I don't see how this could be done, but thought I should ask here before
dismissing the idea.
Thanks
Bill
Jul 17 '05 #1
4 2069
Bill wrote:
Is it possible to somehow activate a page containing a php script by sending
an email to a mailbox on the server?
I have a script that sends out notification emails to an individual. He
wants to receive them continuously until he decides he has seen enough of
them. Then to stop receiving the emails he has to use his browser and go to
the web page that is sending him the emails where he clicks a button.
Would it be possible to arrange things in some way so that all he has to do
is fire off a reply to the most recent email he has received to activate the
script that stops the emails being sent.
I don't see how this could be done, but thought I should ask here before
dismissing the idea.


Sure, but it's not going to be the PHP part that's tricky. The reply-to
address will need to be an address that the mail server knows about,
then instead of delivering mail it gets piped to a script instead. For
instance, on my mail server if the reply-to address was me@exmaple.com,
in the example.com domain alias file I'd put:

me: "|/path/to/script/to/run.php"

Then that script is run every time an email message is sent to it. Of
course, you'll want to check out phpinfo() to see what you have
available for variables from your MTA and such...

In case you are curious, my mail server setup is documented here:
http://www.koivi.com/exim4-config/

--
Justin Koivisto - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #2
>Is it possible to somehow activate a page containing a php script by sending
an email to a mailbox on the server?
Yes, but the requirements for doing it have much more to do with
what you're allowed to do on the server than with PHP. If it's a
"sealed server" with your only access by POP3 or IMAP, it's going
to be harder (in which case, you need to have something grab mail
off the server and that something looks at the mail and sees if
it has to do something special with it).

Many (UNIX, especially) servers allow you to "pipe" incoming email
into a program, sometimes through the use of a .forward file in
your home directory. Sometimes you pipe that mail into "procmail",
which can do all sorts of things to your mail depending on a
configuration file. Also, maybe you have a nice sysadmin who will
put an alias that pipes into a program into the system alias file
for you (but he'll worry about security issues).

So, you write a script that receives the mail, decides if the mail
is the one you want (e.g. the subject line matches the one it's supposed
to trigger on), and then goes and accesses a web page to trigger off
your php script. Be VERY, VERY careful about using pieces of the mail
to insert into a command; this can open huge security holes.

The script on the server could be written in anything, even command-line
PHP. Or it could be written in shell, and use a command like:
lynx http://www.domain.com/foo.php > /dev/null
to access the web server to fire off your PHP script.
I have a script that sends out notification emails to an individual. He
wants to receive them continuously until he decides he has seen enough of
them. Then to stop receiving the emails he has to use his browser and go to
the web page that is sending him the emails where he clicks a button.
Would it be possible to arrange things in some way so that all he has to do
is fire off a reply to the most recent email he has received to activate the
script that stops the emails being sent.
Assuming you have a Reply-to: no************@www.domain.com in the
messages, you can have an alias like:

no-more-emails: "|/usr/local/bin/unsubscribe.php"

where unsubscribe.php is written in command-line php, it can look
at the email, figure out WHO is trying to unsubscribe, (looking at
the mail headers or some other kind of tag you stuck in the message)
and update the database to tell whatever is sending notifications
to stop.
I don't see how this could be done, but thought I should ask here before
dismissing the idea.


Gordon L. Burditt
Jul 17 '05 #3
"Bill" <bi**@spamsucks.com> wrote in message
news:NQ******************@news.xtra.co.nz...
Would it be possible to arrange things in some way so that all he has to
do is fire off a reply to the most recent email he has received to
activate the script that stops the emails being sent.


This isn't exactly what you asked for, but maybe it's an acceptable
alternative (to your client)...

If in the e-mails you send out, you put a link to a web page that's a
'auto-cancel' page (see below), then your client only has to click on that
link to cancel further e-mails. Depending upon the OS and environment he's
running in, this is a single click. It's easier than replying to the
e-mail.

The link he clicks on would be a URL of the general form:

www.xyz.com/cancel.php?id=xxxxxx

where 'xxxxxx' is some unique ID you generate that identifies this guy and
identifies which kind of e-mail you want to cancel. The guy doesn't have to
click on anything on the 'cancel.php' web page. The mere fact that he
visits it (with that URL parameter) cancels further e-mails.

It seems to me that this approach is about on a par with replying to the
e-mail, and it might be a lot less complicated for you to implement (which
means cheaper, faster to get running, and more robust).
--------------------
My e-mail address doesn't have a 2 in it.
Jul 17 '05 #4
Thank you all. These replies have each been very helpful to me! I am a
hobbyist programmer not a pro, so there are a lot of gaps in my
knowledge. Following on from your replies I have made enquiries of my
provider and learnthat I have ssh access to the server which has procmail
installed. I am now reading up about procmail.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: niv | last post by:
i have a database, one of the fields is a hyperlink to a htm file. i want to activate it automaticly as the asp file is loaded no click is needed.so that the background of the BODY part will...
2
by: niv | last post by:
thank you ken for not givving up. i think i dont make my self clear, what i to do is to have a web page that i can administrate its content and apperance from a database, each web page has three...
1
by: Jeppe 1971 | last post by:
Hi Does anyone know of a way to load a HTML-page and examine the document without activating the code? I am trying to create a search-function in javascript. The idea is that the function...
10
by: Martin Dale | last post by:
Dear all, Is there any way to activate the Save As command from Javascript. I would like to have a "Save as" button on a page which has been dynamically created (client side using...
6
by: SF RVN | last post by:
Hmmmm.. a wee bit of a problem: Background default.htm has a left-aligned table serving as a 'navigation menu' and a right-aligned iFrame (named 'viewframe') serving as the 'target' for...
2
by: Mike Strauss | last post by:
Mission impossible? I would like to click on a button on an aspx page, have that trigger a section of code in the code behind, then depending of the results of the code behind execution, execute...
1
by: Jeebu | last post by:
hi, let me explain my problem with a scenario. after completing a registration procees of a user ,an email will be sent to the user for confirmation.the email contains a link and when the user...
3
by: hecsan07 | last post by:
I have the task to ensure users don't duplicate content from my company's site. There is already code in place that disables the copying and pasting of content from the site. However, users who...
2
by: Hrvoje Vrbanc | last post by:
Hello all! As I have only recently started to use native ASP.NET 2.0 data access controls (and found them to be very powerful), I have one question that I was unable to find the answer to: -...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.