Google Answers Logo
View Question
 
Q: Perl script to forward POP3 mail based on number in header ( No Answer,   2 Comments )
Question  
Subject: Perl script to forward POP3 mail based on number in header
Category: Computers > Internet
Asked by: donphiltrodt-ga
List Price: $10.00
Posted: 06 Sep 2002 15:10 PDT
Expires: 06 Oct 2002 15:10 PDT
Question ID: 62391
My mail server uses SpamAssasin to give each incoming message a spam
score and adds a header like this....

X-Spam-Score: 16.9 (****************)
MIME_ODD_CASE,FROM_HAS_MIXED_NUMS,MAY_BE_FORGED,NO_REAL_NAME,FROM_ENDS_IN_NUMS,CLICK_BELOW,EMAIL_MARKETING,WEIRD_PORT,CLICK_HERE_LINK,FREQ_SPAM_PHRASE,CTYPE_JUST_HTML,FORGED_HOTMAIL_RCVD

Neat, huh?

I need a perl script (or freeware, or cheap shareware) that will move
(IE, delete and forward-without-modification) a message from one POP3
account to another if the spam score NUMBER is greater than, say, 10
(a user configurable value.)

Request for Question Clarification by webadept-ga on 06 Sep 2002 20:23 PDT
What do you mean "move to another POP3 account" Are you on the sever?
is it yours? The reason I ask is I could write a script that would get
all the new email, check the SA Number and "send" or "forward" the
message to a new account, but everything is then going to look like it
came from a single address... Unless you got into header manipulation
and rebuilt them, and then used a type of PORT access to the next
account, which gets a bit beyond your current bid. Not much, but
still.

If you are okay with everything coming from "you" rather than everyone
else. I could put the original address from the "sent from" field into
the "reply-to" field, so if you replied it would go to the right
place. That's pretty simple.

webadept-ga

Clarification of Question by donphiltrodt-ga on 07 Sep 2002 01:23 PDT
After giving it some thought(based on your comments), I'm changing the
question.

Since you mentioned that you could write a (perl?) script, here's the
spec...

Check box XYZ every N seconds.  If the numeric value found in the
X-Spam-Score header is greater than the threshold, delete the message
from the server and append the entire message (incl headers) to the
text file.


Configurable parameters...

pop3 server
username
password
check every N seconds
path of text file
spam score threshold

Lemme know what price you require.

Request for Question Clarification by webadept-ga on 07 Sep 2002 01:49 PDT
What OS are you running? Doesn't really matter, but it might, and do
you know how to install MODS on that system? Or are going to need
everything from scratch?

webadept-ga

Request for Question Clarification by webadept-ga on 07 Sep 2002 01:52 PDT
I just read the comment below and it brought up something.. if you are
signing on to a remote Unix computer, and running this, the connection
will have to stay open, otherwise it will stop when you close
connection. I'm under the impression that you are running this on your
desk computer or home computer. Let me know about this as well.

webadept-ga

Clarification of Question by donphiltrodt-ga on 07 Sep 2002 15:30 PDT
>What OS are you running?

WinXP Pro

>Doesn't really matter...

Agreed.  

> Do you know how to install MODS on that system? 

While not a perl coder, I use Perl scripts constantly and can PPM any
module needed.  Current version: 5.6.1.

Clarification of Question by donphiltrodt-ga on 07 Sep 2002 15:33 PDT
> if you are signing on to a remote Unix computer, 
> and running this, the connection will have to stay open

I'm not using a unix shell account in any way.  I have Perl 5.6.1
installed locally.  My local computer will run the Perl script.

> I'm under the impression that you are running this on your
> desk computer or home computer.

Correct.  Thank you for your precision.

Request for Question Clarification by webadept-ga on 08 Sep 2002 23:49 PDT
Hi, 

I'm going to turn this loose on the other researchers here, with some
explanation to help them along. I got the basis of the program to work
using the Mail::POP3Client mod. Everything works except the delete
function off the server. It marks the message as deleted, but its not.
At least on my system its not, which kinda defeats the whole purpose
and that is to get the spam out of your POP3 account, into a file and
off the server. This appears to only be a problem with the mod that is
for Windows (go figure) as on my Linux box it works just fine, in fact
I'm using it now :-)

So, if anyone can find or make a better fix for this, more power to
you. Sorry to have tied this one up for so long, but I didn't want to
admit defeat so easily.

webadept-ga

Clarification of Question by donphiltrodt-ga on 09 Sep 2002 11:32 PDT
>Everything works except the delete
>function off the server. It marks 
>the message as deleted, but its not.

>my Linux box it works just fine, in fact
>I'm using it now :-)
 
As long as the script works correctly on your Linux system, upload
your script as the answer and I'll use other resources to troubleshoot
it on Win32.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Perl script to forward POP3 mail based on number in header
From: markoft-ga on 07 Sep 2002 00:17 PDT
 
It sounds to me like you have a UNIX shell account and wish to sort
incoming mail into different boxes, or simply delete them sight
unseen.  This is the job that procmail is designed to accomplish.  The
command "which procmail" will tell you the path to procmail if it is
installed.  If it is not it wouldn't hurt to ask the system admin to
install it.
Subject: Re: Perl script to forward POP3 mail based on number in header
From: donphiltrodt-ga on 07 Sep 2002 15:35 PDT
 
> It sounds to me like you have a UNIX shell account.

Your ears can deceive you.  |-)  (See clarifications)

> If it is not it wouldn't hurt to ask the system admin to
> install it.

I considered it, but prefer to handle this myself.  He's overworked anyway.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy