[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 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 - Filter command for mark mail read

Filter command for mark mail read

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Filter command for mark mail read

Postby ente » Wed Jan 06, 2010 9:54 am

Hello,
I once got here a wonderfull script combined with a filter which makes pocomal reading a mail coming with an attached PDF, starting Adobet and printing that file.
The only thing I miss is, it is not marking the mail read.

I went looking in the filter tool. I found the perform command "mark message as", but in the next box there is no selection for "read" offered.
Is there another way to get that result? Have I to add this command to the script?
Thanks you for helping...
Ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby Eric » Wed Jan 06, 2010 10:52 am

There's a script in Extras to toggle messages Read/Unread.
Maybe you could incorporate it into your script. :)
Eric
 

Postby MarkB » Thu Jan 07, 2010 3:41 am

What Eric said. :)

There's an alternative you might test if you wish, and if you have a fairly recent version of Poco, and if you have room for two more actions in your filter. Leave the script alone, but in the filter insert this:

Perform
remove header
X-Poco-Status
and
add header
X-Poco-Status: R
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby ente » Sun Jan 17, 2010 2:31 am

Eric wrote:There's a script in Extras to toggle messages Read/Unread.
Maybe you could incorporate it into your script. :)


Hello Eric
thanks for this proposition. I had seen this script before and tried to mix them. But since technical English is a difficult language for me, and script even more, I tried in vain. But I will try once more.
Sorry for being late, I was a way for a few days.
Sincerely, Ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Sun Jan 17, 2010 4:08 am

I urge you to try the filter. It's easy and works fine as far as I can tell.

Image
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby ente » Sun Jan 17, 2010 4:19 am

MarkB wrote:There's an alternative you might test (...) but in the filter insert this:

Perform
remove header
X-Poco-Status
and
add header
X-Poco-Status: R


Hello MarkB

This still works fine as long as the mail goes "straight" from one directory to the next.

A few days ago I lost all mail in the IN directory because someone had marked all mails and had them deleted without realising what he did... (not me...!)

Thats why I created two security folders, one for the incoming mail and one for the outgoing mail, of every mail gets a copy moved from the IN, resp. the SENT folder to these security folders.

I added to the filter for incoming mail the above quoted commands, hoping that the mails in the Security folder get marked as read and the mails in the IN folder stay unread - the opposite is happening: The mails in the IN folder get marked read and the ones moved stay unread.

I realize, it is somehow logic... How would I have to formulate the filter to make it do what I want and not what it is logic?
ente
Last edited by ente on Sun Nov 21, 2010 8:41 am, edited 1 time in total.
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby ente » Sun Jan 17, 2010 4:21 am

MarkB wrote:I urge you to try the filter. It's easy and works fine as far as I can tell.
as I just wrote: It works fine, very fine. :wink:
ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

mark read after copying to other folder

Postby ente » Sat Nov 27, 2010 9:47 am

MarkB wrote:There's an alternative you might test (...) but in the filter insert this:

Perform
remove header
X-Poco-Status
and
add header
X-Poco-Status: R


Hello MarkB

This still works fine as long as the mail goes "straight" from one directory to the next.

A few days ago I lost all mail in the IN directory because someone had marked all mails and had them deleted without realising what he did... (not me...!)

Thats why I created two security folders, one for incoming mail and one for outgoing mail, and now of every mail gets a copy moved from the IN, resp. the SENT folder to these security folders.

To the existing filter for incoming mail

SEARCH TO for gperll@datacomm.ch
THEN
PERFORM copy message TO Sicherheit/SicherheitEingang

I added the above quoted commands, hoping that the mails in the Security folder (=SicherheitEingang) get marked as read and the mails in the IN folder stay unread - the opposite is happening: The mails in the IN folder get marked read and the ones moved stay unread.

I realize, it is somehow logic... How would I have to formulate the filter to make it do what I want and not what it is logic?
ente



the above quoted commands, hoping that the mails in the Security folder get marked as read and the mails in the IN folder stay unread - the opposite is happening: The mails in the IN folder get marked read and the ones moved stay unread.

I realize, it is somehow logic... How would I have to formulate the filter to make it do what I want and not what it is logic?
ente[/quote]
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

mark read after copying to other folder

Postby ente » Sat Nov 27, 2010 9:47 am

MarkB wrote:There's an alternative you might test (...) but in the filter insert this:

Perform
remove header
X-Poco-Status
and
add header
X-Poco-Status: R


Hello MarkB

This still works fine as long as the mail goes "straight" from one directory to the next.

A few days ago I lost all mail in the IN directory because someone had marked all mails and had them deleted without realising what he did... (not me...!)

Thats why I created two security folders, one for the incoming mail and one for the outgoing mail, of every mail gets a copy moved from the IN, resp. the SENT folder to these security folders.

I added to the filter for incoming mail the above quoted commands, hoping that the mails in the Security folder get marked as read and the mails in the IN folder stay unread - the opposite is happening: The mails in the IN folder get marked read and the ones moved stay unread.

I realize, it is somehow logic... How would I have to formulate the filter to make it do what I want and not what it is logic?
ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Sun Nov 28, 2010 2:51 am

Hi, ente.

In summary: You have a filter for incoming mail that copies incoming messages to a folder called SecurityIn, and you want all messages copied to the SecurityIn folder to be marked Read. And similarly for outgoing messages. Correct?

Outgoing messages, and copies of outgoing messages, automatically have the status Read -- without any interferance from us. So a filter that copies messages should be all you need for outgoing mail.

For incoming mail, I suggest that you divide the labour between a FILTER and an EVENT. The filter will copy the messages to the SecurityIn folder. An OnAdd EVENT will change the status of messages added to the SecurityIn folder to Read. It does this by executing a script (or a filter).

Code: Select all
{ MakeRead -- mark message as Read

{ Modifies the X-Poco-Status header by changing U, if present, to R, or
{ inserting R at beginning of line. The position of the R/U is probably
{ not important, but we preserve it just in case.
{
{ We are hacking here. At run time, when this script is run on copied
{ incoming mail by an OnAdd event, the header is blank or absent.
{ Sometime later, normally, Poco would make the status U (for unread).
{ But it doesn't in our case; it leaves our header untouched.
{ That is true of Poco v4. v5 could be different.

ReadHeader $status "X-Poco-Status:" %message

StringPos #pos "U" $status
If #pos < 1 Then CheckR
SubStrings $status "U"
InsertString $status #pos "R"
Goto ChangeHeader

:CheckR
StringPos #pos "R" $status
If #pos > 0 Then Done

{ Neither U nor R
Set #pos 1
InsertString $status #pos "R"

:ChangeHeader
DeleteHeader "X-Poco-Status:" %message
AddHeader %message "X-Poco-Status:" $status

:Done
Exit


-----------------------------------------------------

Here is a note that I wish I had added to my first post in this topic: :oops:

CAUTION: Use a filter to change Read/Unread status only on incoming mail. The status header can contain information in addition to Read/Unread. Therefore, the heavy-handed method of replacing the entire status header with an R, which is all a filter can do, should be used only on incoming mail.
Last edited by MarkB on Sun Nov 28, 2010 5:21 am, edited 1 time in total.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Sun Nov 28, 2010 5:19 am

Changed the script in the preceding post.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Sat Dec 04, 2010 7:42 am

Below is a slightly more polished version of the little script.

Ente, my spider sense is telling me that you disagree with the proposed solution or are having trouble implementing it


Code: Select all
{ MakeRead -- mark message as Read

{ Modifies the X-Poco-Status header by swapping U, if present, for R, or
{ by inserting R at beginning of line. The position of the R/U is probably
{ not important, but we preserve it just in case.
{
{ We are hacking here. At run time, when this script is run on copied
{ incoming mail by an OnAdd event, the header is blank or absent.
{ Sometime later, normally, Poco would make the status U (for unread).
{ But it doesn't in our case; it leaves our header untouched.
{ That is true of Poco v4. v5 could be different.

ReadHeader $status "X-Poco-Status:" %message

If "R" ^ $status Then Done

StringPos #pos "U" $status
If #pos < 1 Then Neither
SubStrings $status "U"
InsertString $status #pos "R"
Goto ChangeHeader

:Neither
InsertString $status 1 "R"

:ChangeHeader
DeleteHeader "X-Poco-Status:" %message
AddHeader %message "X-Poco-Status:" $status

:Done
Exit
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: Filter command for mark mail read

Postby Casey » Fri May 11, 2012 7:06 am

Mark,

I created a script using your most recent post, but I'm not having total success.

I created a filter to move messages from a specific sender to another folder. That part of the filter works.

As a 2nd "and" condition of the filter, I run your script. When a message meeting the filter requirements is received, it is successfully moved to the new folder, but the message is not changed to read and still appears in bold in that folder's view.

I am also unable to find the X-Poco-status:R command listed in the filter options.

Any suggestions?

Casey
PocoMail v 4.8.0.4400
Casey
Poco Tourist
 
Posts: 40
Joined: Fri Nov 19, 2004 5:33 pm

Re: Filter command for mark mail read

Postby MarkB » Fri May 11, 2012 8:21 am

Casey, are you running a filter on incoming mail, or do you want to operate manually on selected messages? If the former, you don't need a script. Just have your filter do this:

Perform remove header
X-Poco-Status
and
Perform add header
X-Poco-Status:R
and
Perform move message to
YourMailbox

The name of the header is not in the drop-down list. Type in X-Poco-Status and X-Poco-Status:R
And of course, change "YourMailbox" to the name of the destination mailbox.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: Filter command for mark mail read

Postby Casey » Fri May 11, 2012 8:51 am

I kept looking for a drop down option for X-Poco-Status and X-Poco-Status:R in the boxes below the Perform boxes, neither which exist.

I didn't realize that I could type strings into those fields.

Thanks!

Casey
Casey
Poco Tourist
 
Posts: 40
Joined: Fri Nov 19, 2004 5:33 pm

Next

Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 0 guests

cron