[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 - Recent update appears to have broken ReadHeader for dates

Recent update appears to have broken ReadHeader for dates

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Recent update appears to have broken ReadHeader for dates

Postby ChrisKnight » Mon Sep 17, 2007 4:03 pm

So today is beyond frustrating with my email. :(

A script I wrote some time ago for sending spam to SpamCop that first made sure the spam was not more than 2 days old is broken after the recent update to build 3910.

For the curious, the 'function' in my script that is now broken:

Code: Select all
:SpamCop
{ test spam is no more than two days old }
{ date retrieval and format }
Embed $months ***
January
February
March
April
May
June
July
August
September
October
November
December
***
ReadHeader $msgDate "Date:" %message 
StringPos #Pos "," $msgDate
If #Pos = 0 Then NoWeekDay
ChopString $msgDate 1 #Pos
:NoWeekDay
Trim $msgDate
StringPos #Pos " " $msgDate
CharCount #Len $msgDate
Set $msgDay $msgDate
ChopString $msgDay #Pos #Len
ChopString $msgDate 1 #Pos
StringPos #Pos " " $msgDate
CharCount #Len $msgDate
Set $msgMonth $msgDate
ChopString $msgMonth #Pos #Len
ChopString $msgDate 1 #Pos
StringPos #Pos " " $msgDate
CharCount #Len $msgDate
Set $msgYear $msgDate
ChopString $msgYear #Pos #Len
LocateLine #Pos $msgMonth $months
AddIntegers #Pos 1
Set $msgMonth #Pos
AddStrings $spamDate $msgMonth "/" $msgDay "/" $msgYear
GetDate $Now
SubDays #age $spamDate $Now
If #age>2 Then SkipSend
If #age=-1 Then ErrorHandler2
{ set forward recipient }
Addstrings $address "submit." $userdata1 "@spam.spamcop.net"
Set $To $address
Call TestMode
{ set forward subject }
Set $Subject "Spam Submission"
Call BuildForward
If $ScriptFeature7="no" Then Return
Addstrings $SpamCopTag "Forwarded to SpamCop on " $Date " at " $Time "."
Goto Return1
:SkipSend
Addstrings $SpamCopTag "Not Forwarded to SpamCop on " $Now " : Spam too old!"
Goto Return1


In looking for the reason it is failing I seem to have found a new 'bug' :?: that was not in the last build I was on. For some reason when using ReadHeader to get the message Date: header it is returning the message Delivery-Date: header value, and curiously I can't seem to get the Delivery-Date: header if I wanted it. I've never tried to before now so I've no idea if this is a new issue or not.

Anyway, this test script will illustrate the problem;
Code: Select all
ReadHeader $msgDate "Date:" %message
if $msgDate = "" then noDate
:Resume1
ReadHeader $msgDDate "Delivery-Date:" %message
if $msgDDate = "" then noDDate
:Resume2
Set $text1 "The header Date: is-> "
Set $text2 " and the header Delivery-Date: is-> "
Addstrings $textOut $text1 $msgDate $text2 $msgDDate
MessageBox $textOut
Exit
:noDate
Set $msgDate "missing"
Goto Resume1
:noDDate
Set $msgDDate "missing"
Goto Resume2


:arrow: Create a new script with the above, enable viewing headers and select a message that has different values for the Date: and the Delivery-Date: and run the script, if you use the debug run you can also view the variables and see they are not what you can see by examining the headers in the email visually.

I don't know if anybody else uses the date headers in their scripts, if you do to control logic I expect the script will be broken.

I'd like to know if anyone else can verify this, I truly hope there are plenty of users who could be effected by this, not because I'm having a bad email day and misery likes company but because if enough people are effected perhaps it can be fixed soon.
:wink:

~Chris
ChrisKnight
Poco Tourist
 
Posts: 26
Joined: Sat Jul 01, 2006 6:27 am
Location: Portland, OR

Postby Michael » Tue Sep 25, 2007 3:05 pm

Hi Chris,

I cannot confirm this as a bug, the test script I wrote returns different values for the date and delivery-date headers.

Code: Select all
ReadHeader $msgDate "Date:" %message
AddStrings $Msg "Date header is:" $msgDate
MessageBox $Msg

Set $Msg ""
ReadHeader $msgDate "Delivery-Date:" %message
AddStrings $Msg "Date header is:" $msgDate
MessageBox $Msg
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby ChrisKnight » Tue Sep 25, 2007 4:05 pm

Hello Michael,

Thanks for the reply!! :D

Often enough I don't get one.

I may have to change my post, I'm going to have to investigate this further.

I tried your script out. Same thing for me. The date header does not return a value. So in this case the second message box just says "Date header is:"

I tried it out on several different emails that I verified have different and valid values for the date and delivery-date headers.
Same thing, only the first box has a date and it is not the date from the email.

But the date I was getting is not even in the delivery-date it is todays date!! So I can see how I missed this before all the email I was trying had a delivery date of the day I had discovered a problem. Now here is another weird thing, I have been using debug run to run the script. Well I saved it and ran it using run on selected messages and it worked as it should.

SO now I will have to go back and experiment some more, the problem may be with using debug run.

Before the update, I could get the date header no problem, now it always come blank
ChrisKnight
Poco Tourist
 
Posts: 26
Joined: Sat Jul 01, 2006 6:27 am
Location: Portland, OR

Postby Michael » Wed Sep 26, 2007 1:09 am

Hi Chris,

I made a small change to the test script and have run it again. It does produce results for both headers for me. The new script is:

Code: Select all
Set $Header "Date"
ReadHeader $msgDate $Header %message
AddStrings $Msg $Header " header is:" $msgDate
MessageBox $Msg

Set $Header "Delivery-Date"
Set $Msg ""
ReadHeader $msgDate $Header %message
AddStrings $Msg $Header " header is:" $msgDate
MessageBox $Msg


Also, running in debug mode will produce the results you are reporting. Debug mode runs with a blank message rather than the current message.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron