Run PHP script to do stuff to an email in the inbox

View: New views
4 Messages — Rating Filter:   Alert me  

Run PHP script to do stuff to an email in the inbox

by Duncan Clarkson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

We want to add functionality to a web-based email client that will allow us to classify each email in the inbox and create a record in a database with some of the content of that email. For example, a link would be available when viewing each email that would launch a window with the classification options and a submit button. When the submit button is clicked some of the content of the email is added to the database with classification information.

Assuming the classification system already exists as a PHP script, how easy would it be to integrate into SquirrelMail using the plugin architecture? Is the plugin arhitecture designed for this type of customisation?

Duncan

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-plugins@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins

Re: Run PHP script to do stuff to an email in the inbox

by Paul Lesniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 24, 2008 at 6:10 AM, Duncan Clarkson <dnc@...> wrote:

> Hi,
>
> We want to add functionality to a web-based email client that will allow us
> to classify each email in the inbox and create a record in a database with
> some of the content of that email. For example, a link would be available
> when viewing each email that would launch a window with the classification
> options and a submit button. When the submit button is clicked some of the
> content of the email is added to the database with classification
> information.
>
> Assuming the classification system already exists as a PHP script, how easy
> would it be to integrate into SquirrelMail using the plugin architecture? Is
> the plugin arhitecture designed for this type of customisation?

Using the Spam Buttons plugin, you merely need to use your script as
the "report by custom function" backend.  So you don't need to build a
plugin - just configure Spam Buttons to use your script.

Cheers,

Paul

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-plugins@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins

Re: Run PHP script to do stuff to an email in the inbox

by Duncan Clarkson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the reply. I've installed the spam_buttons plugin and configured it to use a custom function. Here is my simple test function:

function hello_world($message_ids, $passed_ent_id) {
  echo 'Hello World!';
  touch('/tmp/mrchicken');
  return '';
}

In this case I know the function executes as the file is created (although I'm not sure where the output from the echo has gone as it doesn't appear in the source of the page that is returned).

What's not clear to me is how to use this custom function to launch a window with a form the user can interact with (or redirect to a page with a form). How can I achieve this kind of behaviour with the plugin?

Duncan

2008/10/24 Paul Lesniewski <paul@...>
On Fri, Oct 24, 2008 at 6:10 AM, Duncan Clarkson <dnc@...> wrote:
> Hi,
>
> We want to add functionality to a web-based email client that will allow us
> to classify each email in the inbox and create a record in a database with
> some of the content of that email. For example, a link would be available
> when viewing each email that would launch a window with the classification
> options and a submit button. When the submit button is clicked some of the
> content of the email is added to the database with classification
> information.
>
> Assuming the classification system already exists as a PHP script, how easy
> would it be to integrate into SquirrelMail using the plugin architecture? Is
> the plugin arhitecture designed for this type of customisation?

Using the Spam Buttons plugin, you merely need to use your script as
the "report by custom function" backend.  So you don't need to build a
plugin - just configure Spam Buttons to use your script.

Cheers,

Paul

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-plugins@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-plugins@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins

Re: Run PHP script to do stuff to an email in the inbox

by Paul Lesniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 5, 2008 at 6:22 AM, Duncan Clarkson <dnc@...> wrote:

> Thanks for the reply. I've installed the spam_buttons plugin and configured
> it to use a custom function. Here is my simple test function:
>
> function hello_world($message_ids, $passed_ent_id) {
>   echo 'Hello World!';
>   touch('/tmp/mrchicken');
>   return '';
> }
>
> In this case I know the function executes as the file is created (although
> I'm not sure where the output from the echo has gone as it doesn't appear in
> the source of the page that is returned).
>
> What's not clear to me is how to use this custom function to launch a window
> with a form the user can interact with (or redirect to a page with a form).
> How can I achieve this kind of behaviour with the plugin?

Sorry for not replying sooner; I lost track of this one.  You would
have two options:

Create a plugin that places a drop-down list of your classifications
on the page and hook it into your code or the Spam Buttons custom
button backend.  Look at how the Spam Buttons plugin puts buttons in
the interface as one example of how to put the drop down in place.

Or, using the function you have created, you'd probably need to do a
header redirect and exit so the function never returned -- the reason
you are not seeing your echoed text is that after it executes, the
page is immediately redirected.



> 2008/10/24 Paul Lesniewski <paul@...>
>>
>> On Fri, Oct 24, 2008 at 6:10 AM, Duncan Clarkson <dnc@...> wrote:
>> > Hi,
>> >
>> > We want to add functionality to a web-based email client that will allow
>> > us
>> > to classify each email in the inbox and create a record in a database
>> > with
>> > some of the content of that email. For example, a link would be
>> > available
>> > when viewing each email that would launch a window with the
>> > classification
>> > options and a submit button. When the submit button is clicked some of
>> > the
>> > content of the email is added to the database with classification
>> > information.
>> >
>> > Assuming the classification system already exists as a PHP script, how
>> > easy
>> > would it be to integrate into SquirrelMail using the plugin
>> > architecture? Is
>> > the plugin arhitecture designed for this type of customisation?
>>
>> Using the Spam Buttons plugin, you merely need to use your script as
>> the "report by custom function" backend.  So you don't need to build a
>> plugin - just configure Spam Buttons to use your script.
>>
>> Cheers,
>>
>> Paul
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> -----
>> squirrelmail-plugins mailing list
>> Posting guidelines: http://squirrelmail.org/postingguidelines
>> List address: squirrelmail-plugins@...
>> List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
>> List info (subscribe/unsubscribe/change options):
>> https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> -----
> squirrelmail-plugins mailing list
> Posting guidelines: http://squirrelmail.org/postingguidelines
> List address: squirrelmail-plugins@...
> List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
> List info (subscribe/unsubscribe/change options):
> https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins
>



--
Paul Lesniewski
SquirrelMail Team
Please support Open Source Software by donating to SquirrelMail!
http://squirrelmail.org/donate_paul_lesniewski.php

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-plugins@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins