[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 - Month and Year a message was recieved/delivered

Month and Year a message was recieved/delivered

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Month and Year a message was recieved/delivered

Postby adsworth » Tue Sep 27, 2005 1:08 am

Hi,

anyone know how I can get the month and year of when a mail was delivered. A little Background info. I have a mailbox with 14000 mails in it, these are mails from a mailing list. I would now like to write a script that moves the mails into a per month mailbox.

adi
adsworth
Drop-in Visitor
 
Posts: 14
Joined: Fri Sep 23, 2005 2:49 am

Postby Michael » Tue Sep 27, 2005 1:34 pm

Try the following, you may need to make changes if you use a different date format than I do:
Code: Select all
{  Determine the month and day a message was sent.

Embed $months @@@
January
February
March
April
May
June
July
August
September
October
November
December
@@@

ReadHeader $msgdate "Date:" %message
StringPos #ix "," $msgdate
If #ix = 0 Then NoComma
ChopString $msgdate 1 #ix
:NoComma
Trim $msgdate
StringPos #ix " " $msgdate
ChopString $msgdate 1 #ix
Set $MsgYear $msgdate
StringPos #ix " " $msgdate
ChopString $msgdate #ix 9999
ChopString $MsgYear 1 #ix

LocateLine #ix $msgdate $months
GetLine $MsgMonth #ix $months

StringPos #ix " " $MsgYear
ChopString $MsgYear #ix 999

AddStrings $MsgMonth " " $MsgYear

MessageBox $MsgMonth
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby adsworth » Thu Sep 29, 2005 7:51 am

Michael wrote:Try the following, you may need to make changes if you use a different date format than I do:
Code: Select all
code snipped



Thanks, that looks like it does the trick.
with the few different mails I've tried, the script always returned the correct date.

adi
adsworth
Drop-in Visitor
 
Posts: 14
Joined: Fri Sep 23, 2005 2:49 am


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 0 guests

cron