Roundcube Community Forum

 

ASSP Toolbar Plugin

Started by toetag, November 09, 2009, 10:04:06 PM

Previous topic - Next topic

toetag

I'm trying to work on an ASSP Toolbar plugin that replicates the ASSP toolbar for Outlook.

ASSP provides an email interface for reporting spam, not spam, add whitelist and add blacklist.   The ASSP toolbar for outlook provides configurable buttons, so that you can select email(s), then press the button and have them automatically forwarded to the preset ASSP interface email addresses.

I've never worked with PHP but i've been reverse engineering several of the available plugins and have been able to add a button, place it in the interface and configure events and hooks.

the point i'm stuck at now is having the button actually send an email.  I've been looking at all the documentation (RoundCube Classes) and the wiki and for the live of me, i can't figure out what i need to do.

  write_log('errors', 'Report Spam button was pushed');
   $sent = $rcmail::smtp_mail('','','','This is a test',$smtp_response, $smtp_errors);

[09-Nov-2009 21:59:05] PHP Fatal error:  Class name must be a valid object or a string in C:\data\wwwroot\webmailtest\plugins\assp_reporting\assp_reporting.php on line 46

/btw, i should say that i'm a hardware geek by trade and a software hack by hobby. delphi, vb6, vb.net, c#.
<[ a desert to an irishman is an empty glass. ]>

rosali

You could use my 'sendmessage' plugin bundled with myroundcube plugins (link see signature).
Regards,
Rosali

SKaero

The first error I see is $rcmail should be rcmail like:
$sent rcmail::smtp_mail('<emailTO>','<emailFrom>','','T his is a test',$smtp_response$smtp_errors);

JohnDoh

if you take a look at the email_learn driver in the markasjunk2 plugin repo (drivers/email_learn.php at master from JohnDoh's RoundCube-Plugin-Mark-as-Junk-2 - GitHub) there is code there which sends emails and also emails with attachments, may be that will help.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

toetag

Rosali, I saw your plugin but it was my intention to try and keep my plugin independent of others (i may change my opinion but i think I can tackle this). Especially since their is a handy "smtp_mail" method in the documentation i found.

skaero, Thank you.  syntax is going to be a learning curve.  I tend to reverse engineer with sweat and muscle.

JohnDoh, I'll give it another look over.  when i first looked at it i thought it was file system based, not sending an email.
<[ a desert to an irishman is an empty glass. ]>

Jason_Bassford

This is interesting, because (as far as I know) ASSP requires that the spam message be actually bounced / redirected - not just replied to or forwarded.  This is a function that ASSP doesn't currently have - I've actually been looking for it specifically for being able to redirect to ASSP for spam reporting.  (This is one reason I've had to keep my installation of SquirrelMail intact - and I only use it for spam reporting.)

I'm guessing that if/when this is implemented, it would lead the way to having a redirect plugin also.

toetag

Actually, you might have just made it EASIER.  I never even bothered to see HOW the ASSP toolbar works.  It does forward the email as an attachment.

As luck would have it....guess what there already is.... a forward as attachment plugin by rosali.  Plugin_Repository ? Roundcube Webmail

Rosali, can i try to modify that for my needs?
<[ a desert to an irishman is an empty glass. ]>

rosali

Well, it would be easy to inject a "learn account" around here:


      $_SESSION
['compose']['param']['subject'] = "Fwd: " substr($att_subject,0,strlen($att_subject)-2);
      
$rcmail->output->redirect(array('_action' => 'compose''_id' => $_SESSION['compose']['id'])); 
      exit;


... but I'm not sure at the moment how to trigger and automated "send" command here.
Regards,
Rosali

toetag

found another issue to resolve.

ASSP - port 25
hMail - imap
roundcube sends through imap

hmail configured to host "testdomain.com"
roundcube: forward email to "[email protected]"

hMail would get this email through imap. hMail knows that domain is locally hosted, ASSP would never see the report.

I might have to use your "sendmail" plugin as you first suggested.
<[ a desert to an irishman is an empty glass. ]>

toetag

Sweet, i can fake out hMail.

hosts file:
127.0.0.1 bogusdomain.com


Configured assp to relay for the bogus domain. Sent an email through hMail IMAP, watched the logs, saw hMail accept it, watched it send it, then saw the connection go to ASSP:

hMail log:
264 "2009-11-12 13:10:54.859" "127.0.0.1" "SENT: RCPT TO:"

ASSP log:
Nov-12-09 13:11:04 49464-09597 127.0.0.1 email: combined spam &
whitelist report
<[ a desert to an irishman is an empty glass. ]>

gwoc

So how's the situation with this? Did you actually get it working? Will you be sharing the plugin at some point?

I'm quite interested in this.

toetag

It's a bit slow right now. I started off fast and made a bit of progress.  I'm trying to find time to work on this but my job has gotten in the way for the moment.

so far, i've been able to modify rosali's plugin "forward as attachment" and have roundcube configure a message for forwarding with the original as an attachment and prefill in the TO: field of the form.  I haven't perfected the "automatic sending" as of yet.

I've been looking at JohnDoh's plugin "mark as spam", i believe between the two of them, i can get the crucial "auto send" piece working correctly.

Once I have something that does the main requirements, i'll post it for testing.
<[ a desert to an irishman is an empty glass. ]>

rosali

Check your PM's. I've sent you an instruction how to do the "automatic sending" a while ago.
Regards,
Rosali

gwoc


toetag

Should have posted this weeks ago.

The update is that JohnDoh's "mark_as_spam2" plugin has all the features for reporting spam and ham and works with ASSP.

He's modified his original plugin to incorporate the "foward as attachment" function needed by ASSP.

You can now configure his plugin to "sendmail" on reporting and configure the email addresses ASSP will listen for reporting.
<[ a desert to an irishman is an empty glass. ]>