[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - download only known senders, delete & save rest

download only known senders, delete & save rest

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

download only known senders, delete & save rest

Postby Tomas » Sat Dec 02, 2006 3:49 am

Story: Only messages from senders in your address book are allowed. The rest gets deleted, while some headers (from, to, date, subject) are still saved for occasional inspection - those are sent to Junk Mail.mbx.

Setup:
change the line
Code: Select all
IsAddressPresent &present $email "Address"

to replace the "Address" with an exact name of your own address book against which you want to filter, the name must stay quoted. (I know there is a possibility in Pocoscript to add it as an option instead of having to edit the script....maybe later)

!If you make an error in the above part, all your incoming mail will be deleted!

Add it to your pre-download filters.

Disclaimer:

No guarantees whatsoever, I'm not responsible for any data losses, you can only use it on your own risk. It comes from a complete scripting greenhorn.

If you will find any bugs, or have feature enhancements, you are more than welcome.

No error checks are done, no checks for the presence of address book nor Junk Mail.mbx, nor for it being run in the correct mode (pre-download).

Code: Select all
Set $OnErrorGoTo ErrorHandler
ReadHeader $email "From:" %message
Lowercase $email
IsAddressPresent &present $email "Address"
if &present then GoodOne

#Junk feeder part
AppendToFile True
ReadHeader $subject "Subject:" %message
ReadHeader $to "To:" %message
ReadHeader $date "Date:" %message
CreateMessage %junkmessage
AddHeader %junkmessage "From:" $email
AddTo %junkmessage $to
AddHeader %junkmessage "Date:" $date
AddHeader %junkmessage "Subject:" $subject
SaveMessage %junkmessage "Junk Mail.mbx"
DeleteMessage %message
Exit

:GoodOne
Exit

:ErrorHandler
set $err "error encountered"
MessageBox $err
Tomas
Pillar of the Community
 
Posts: 1418
Joined: Sun Jul 25, 2004 1:34 am

Postby FieldDir121 » Sat Dec 09, 2006 3:54 am

Tomas,

Here is a low risk method that may accomplish the same thing:

In Accounts under the Mailboxes tab set incoming to "Junk Mail".
Then have this filter:

Search "From"
for "%addressbooks%" then
Perform "move message to" "good mail" where Good Mail is the mailbox where you want good messages to end up.

No mail will be lost. Anyone in the address book will make it to the selected mailbox and all others will go to Junk where they can be scanned or deleted.

This is how I have Poco set up for my wife and children.

Scott
FieldDir121
Resident Poster
 
Posts: 149
Joined: Mon Aug 02, 2004 5:18 pm

Postby Tomas » Sat Dec 09, 2006 4:53 am

Thanks Scott!

I have written the above script specifically for a client who didn't want to get whole messages to junk box, only headers. I'm not sure why, maybe they were on a dial-up or whatever.

Anyway, your post will be helpful for people who will read this thread, as I guess most users will go the way you outlined, and it's also the recommended way.
Tomas
Pillar of the Community
 
Posts: 1418
Joined: Sun Jul 25, 2004 1:34 am


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron