[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 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 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 - Delete Messages From Server via A Script?

Delete Messages From Server via A Script?

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Delete Messages From Server via A Script?

Postby dblayout » Fri Sep 03, 2004 4:21 am

I check my mail from 2 pc's. On one pc (work) I have Leave On Server checked on, at Home, I have it unchecked so when it downloads the messages, it removes them from the server. Well, I get 100's of spam mail every day on this account. I have a script that runs on downloaded mail. If the from address on the incoming email is in my address book, I move it to the IN box, otherwise I move it to the Junk mailbox. This works perfectly. No I would like to actually delete the 'Junk' messages from the server while leaving the good mail on the server (from my Work pc). DELETEMESSAGE does not remove the mail from the server, only from a specific mailbox. How do I remove a message from the server?

Thanks.
Chris Moore
dblayout
Poco Tourist
 
Posts: 46
Joined: Fri Aug 06, 2004 4:11 am
Location: Dallas, TX

Postby Pete » Fri Sep 03, 2004 5:19 am

I'm not aware of a built-in way to do this with PocoScript.

I've never tried this, but instead of using PocoScript, you could experiment with creating an OnAdd event for the Junk mailbox that runs a filter that deletes the message from the server. Please let us know if this works because I think that some other people might be interested in this.

One caution: the behavior of the Junk mailbox in Barca/PocoMail might change in the future so you might have to stop using such an OnAdd event if that happens.
Pete
 

Postby myname » Sat Sep 11, 2004 4:11 am

Has anyone found, wrote a script to delete email from the server? I would like to see if there is an answer out there before I attempt to do the research and try it for myself. Though, I've never coded in pocoscript so who knows, I may end up deleting the internet. :)

--Kevin
myname
Frequent Visitor
 
Posts: 97
Joined: Fri Aug 13, 2004 1:08 am

Postby Michael » Sat Sep 11, 2004 4:13 am

The DeleteMessage command will delete a message from the server when the script is run in Pre-Download mode. I have use this all the time although only on POP3 servers.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby myname » Sat Sep 11, 2004 4:18 am

I guess I am unsure how this works. I am assuming that I would need to run the script before poco/barca downloads the mail, or after the mail has been downloaded, I would view the mail on the server and delete the messages I don't want...

correct?

Is there a way within barca/poco, as I read a message, or delete a message, that it would get deleted from the server? This would be post-download.

--Kevin
myname
Frequent Visitor
 
Posts: 97
Joined: Fri Aug 13, 2004 1:08 am

Postby Michael » Sat Sep 11, 2004 5:06 am

The following applies to POP3 servers, I have not investigated how the functions work with respect to IMAP servers.

Unfortunately only scripts (and filters) run in Pre-Download mode can delete messages from the server, all other modes work on the local copy of the message within the Poco mailbox.


You can use the View Mail on Server function to delete messages from the server but that is a manual process and is not, to the besty of my knowledge, script enabled.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby myname » Sat Sep 11, 2004 5:14 am

When you say filters work on pre-download mode, do they also work on messages after they are downloaded?

The reason why I'm asking is, it seems like every day or two, the baysian filters stop working, and all my spam ends up in my inbox. I have all the other spam filters disabled.

Back on the original topic, could a script be written to scan messages before they are downloaded, then mark the ones that don't meet a specific criteria to download and delete from the server? This would leave the messages I want on the server.

In psuedocode:

If message subject equals "Leave me on server"
download message and leave on server
else
download message and delete from server
end if

--Kevin
myname
Frequent Visitor
 
Posts: 97
Joined: Fri Aug 13, 2004 1:08 am

Postby Michael » Sat Sep 11, 2004 5:28 am

myname wrote:When you say filters work on pre-download mode, do they also work on messages after they are downloaded?


In addition to running in response to events, filters (and scripts) can run in the following modes:[list][*]Pre-Download - while the messages are still on the server, before they are downloaded into the local mail store[*]Incoming - immediately after the message has been read into the local mail store[*]Outgoing - immediately before a message is sent (giving you the ability to alter the outgoing message)[*]Post-Send - After the message has been sent (useful for moving messages into mailboxes, this is better than using an Outgoing filter because only those messages successfully sent are stored).[*]Manual - You can select one (or more) messages from a mailbox and run one of the manual filter sets or individual scripts against them. You can assign a script to a button and use it this way.

myname wrote:The reason why I'm asking is, it seems like every day or two, the baysian filters stop working, and all my spam ends up in my inbox. I have all the other spam filters disabled.


The above modes should not affect the Bayesian filtering, I would check to see that you have enough words in the good and spam corpuses (which, given this feature was working I suspect you have). I would also check to ensure you do no have any filter with a "Stop processing" action in it. If this were before the junk mail filters it could cause what you are seeing.

myname wrote:Back on the original topic, could a script be written to scan messages before they are downloaded, then mark the ones that don't meet a specific criteria to download and delete from the server? This would leave the messages I want on the server.

In psuedocode:

If message subject equals "Leave me on server"
download message and leave on server
else
download message and delete from server
end if

--Kevin


Yes, I do pretty much what you are wanting. You can only really check the header information but I check several headers in making my determination of whether or not to delete the message from the server.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby myname » Sat Sep 11, 2004 5:48 am

Do you have an example script I could take a look at for this?

--Kevin
myname
Frequent Visitor
 
Posts: 97
Joined: Fri Aug 13, 2004 1:08 am

Postby Michael » Sat Sep 11, 2004 6:44 am

myname wrote:Do you have an example script I could take a look at for this?

--Kevin


The script I use is quite large and was written for commercial purposes but I can provide a short snippet that demonstrates this:

Code: Select all
ReadHeader $Subject "Subject:" %message
LowerCase $Subject
If "viagra" ^ $Subject Then DeleteMsg
Exit

:DeleteMsg
DeleteMessage %message
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby myname » Sat Sep 11, 2004 6:54 am

Thanx... I will work with this and see what I can come up with.
myname
Frequent Visitor
 
Posts: 97
Joined: Fri Aug 13, 2004 1:08 am


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 3 guests

cron