Re: [Evolution] Script to search mails

2010-08-15 Thread Reid Thompson

On 8/15/2010 12:32 AM, Thomas Mittelstaedt wrote:


Also, you could define a filter. As action you could choose to call a
program or pipe the mail through a program.


re above, you could take the first part of this filter script  and modify it to match and write out data for 
the emails you want.  You might want to switch it from using the tmail package to the mail package.

It would prob end up being around 10 lines long, not counting comments (read 
in, parse, match, write out)

$ cat forwardmail.rb
#!/usr/bin/ruby

require 'rubygems'
require 'tmail'
require 'net/smtp'

# setup to  from
#
tomail = 'john@someplace.com'
frommail = 'jane.d...@elsewhere.com'

# read in mail from pipe
forwarded_mail = TMail::Mail.parse($stdin.read)

# grab the original sender
# strip the domain from original sender address
#
sender = forwarded_mail.from
idx = sender[0].index('@')
sender[0].slice!(idx.to_i..sender[0].length)

# grab the send date
#
senddate = forwarded_mail.date

# populate the new header information
#
forwarded_mail.to = tomail
forwarded_mail.from = frommail
newsubject = FW:  + forwarded_mail.subject.to_s
forwarded_mail.subject = newsubject
forwarded_mail.date = Time.now

# setup the new mail body
#
forwarded_mail.body = On #{senddate} #{sender} said \n\n + forwarded_mail.body

# send the mail
#
Net::SMTP.start( 'your_mail.host.com', 25 ) do|smtpclient|
smtpclient.send_message(
forwarded_mail.to_s,
frommail,
tomail
)
end

___
evolution-list mailing list
evolution-list@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-list


Re: [Evolution] Script to search mails

2010-08-14 Thread Chris Blake
-Original Message-
From: Reid Thompson reid.thomp...@ateb.com
Reply-to: reid.thomp...@ateb.com
To: ch...@igroup.co.za
Cc: evolution-list@gnome.org
Subject: Re: [Evolution] Script to search mails
Date: Sat, 14 Aug 2010 10:38:09 -0400
perhaps
http://grepmail.sourceforge.net/

or gnu mailutils

Hi Reid,

Thanks for the prompt reply and links, much appreciated.

I will investigate from here.

Kind Regards

--
Chris Blake
ch...@igroup.co.za

Tel: 0861 IGROUP (447 687) Ext: 2237   |Int: +27 11 712-3900|
Fax: 011 507-5749|   www.igroup.co.za

Search Engine Marketing Services –www.igroupseo.co.za  | iGroup Call
Centre Outsourcing – email sa...@igroup.co.za

Delays in responding to emails will result in delays in project
completion dates and may incur additional charges. Use of this e-mail
and any attachments to it is subject to our e-mail Terms and Conditions
located at http://www.igroup.co.za/legal/email-disclaimer.htm - please
review these now. If you cannot access them, please call 0861 447 687 or
INT +27 11 712-3900 or email i...@igroup.co.za



___
evolution-list mailing list
evolution-list@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-list


Re: [Evolution] Script to search mails

2010-08-14 Thread Reid Thompson

On 8/14/2010 10:42 AM, Chris Blake wrote:

-Original Message-
From: Reid Thompsonreid.thomp...@ateb.com
Reply-to: reid.thomp...@ateb.com
To: ch...@igroup.co.za
Cc: evolution-list@gnome.org
Subject: Re: [Evolution] Script to search mails
Date: Sat, 14 Aug 2010 10:38:09 -0400
perhaps
http://grepmail.sourceforge.net/

or gnu mailutils




you might also try
http://do.homeunix.org/MailboxParsingWithAwk.html?DevelopmentResources

or ruby or other scripting languages
what format is your evolution mail in mbox, maildir, 

see the ruby script on this page -- mod it to output what you want, rather than 
splitting the file
http://blog.ganneff.de/blog/2008/05/01/splitting-huge-mbox-files.html
___
evolution-list mailing list
evolution-list@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-list


Re: [Evolution] Script to search mails

2010-08-14 Thread Chris Blake
 -Original Message-
 From: Reid Thompson reid.thomp...@ateb.com
 Reply-to: reid.thomp...@ateb.com
To: ch...@igroup.co.za
Cc: evolution-list@gnome.org
Subject: Re: [Evolution] Script to search mails
Date: Sat, 14 Aug 2010 10:56:08 -0400
you might also try
http://do.homeunix.org/MailboxParsingWithAwk.html?DevelopmentResources

or ruby or other scripting languages
what format is your evolution mail in mbox, maildir, 

see the ruby script on this page -- mod it to output what you want, rather 
than splitting the file
http://blog.ganneff.de/blog/2008/05/01/splitting-huge-mbox-files.html


Hi Reid,

Thanks once again for the tips, but I found it was easier to simply do :

grep Subject: COZA: OKAY: Updated domain CO.ZA\ Data  updated.txt

...straight from the command line in the Evolution local data folder.

At least I have a better understanding now of how Evolution mailboxes
work.

Thank you again for your desire to help, much appreciated.

-- 
Kind Regards

--
Chris Blake
ch...@igroup.co.za

Tel: 0861 IGROUP (447 687) Ext: 2237   |Int: +27 11 712-3900|
Fax: 011 507-5749|   www.igroup.co.za

Search Engine Marketing Services –www.igroupseo.co.za  | iGroup Call
Centre Outsourcing – email sa...@igroup.co.za

Delays in responding to emails will result in delays in project
completion dates and may incur additional charges. Use of this e-mail
and any attachments to it is subject to our e-mail Terms and Conditions
located at http://www.igroup.co.za/legal/email-disclaimer.htm - please
review these now. If you cannot access them, please call 0861 447 687 or
INT +27 11 712-3900 or email i...@igroup.co.za



___
evolution-list mailing list
evolution-list@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-list


Re: [Evolution] Script to search mails

2010-08-14 Thread Reid Thompson

On 8/14/2010 10:32 AM, Chris Blake wrote:

Greetings community,

I have a specific folder in my Inbox which I need to search for emails
and manipulate the results.

I need to do this on the command line, something like :

SELEECT * from the Inbox/Folder_To_Search
WHERE Subject CONTAINS 'keyphrase'
AND date received is less than 01 August 2010

I want to have the full subject line of that email piped into a text
file so I can manipulate it with other bash commands.

Can someone help me, or point me to a tutorial on how I can script with
the Evolution folders, if possible.

So far Google search has given me no results I can work with, still
searching...

Thanks for your replies...


perhaps
http://grepmail.sourceforge.net/

or gnu mailutils
___
evolution-list mailing list
evolution-list@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-list


Re: [Evolution] Script to search mails

2010-08-14 Thread Patrick O'Callaghan
On Sat, 2010-08-14 at 17:21 +0200, Chris Blake wrote:
 grep Subject: COZA: OKAY: Updated domain CO.ZA\ Data  updated.txt
 
 ...straight from the command line in the Evolution local data folder.

That's fine if the mailbox is local (which you hadn't said before) and
if it's in mbox format (it could be a maildir).

poc

___
evolution-list mailing list
evolution-list@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-list


Re: [Evolution] Script to search mails

2010-08-14 Thread David Woodhouse
On Sat, 2010-08-14 at 16:32 +0200, Chris Blake wrote:
 Greetings community,
 
 I have a specific folder in my Inbox which I need to search for emails
 and manipulate the results.
 
 I need to do this on the command line, something like :
 
 SELEECT * from the Inbox/Folder_To_Search
 WHERE Subject CONTAINS 'keyphrase'
 AND date received is less than 01 August 2010
 
 I want to have the full subject line of that email piped into a text
 file so I can manipulate it with other bash commands.
 
 Can someone help me, or point me to a tutorial on how I can script
 with the Evolution folders, if possible.
 
 So far Google search has given me no results I can work with, still
 searching...
 
 Thanks for your replies... 

It's easiest if you don't do this kind of thing with Evolution -- do it
directly on the IMAP server instead.

Here's a quick hack based on my quarterly archive script...

-- 
dwmw2


search.sh
Description: application/shellscript
___
evolution-list mailing list
evolution-list@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-list


Re: [Evolution] Script to search mails

2010-08-14 Thread Thomas Mittelstaedt
Am Samstag, den 14.08.2010, 16:32 +0200 schrieb Chris Blake:
 Greetings community,
 
 I have a specific folder in my Inbox which I need to search for emails
 and manipulate the results.
 
 I need to do this on the command line, something like :
 
 SELEECT * from the Inbox/Folder_To_Search
 WHERE Subject CONTAINS 'keyphrase'
 AND date received is less than 01 August 2010
 
 I want to have the full subject line of that email piped into a text
 file so I can manipulate it with other bash commands.
 
 Can someone help me, or point me to a tutorial on how I can script with
 the Evolution folders, if possible.
 
 So far Google search has given me no results I can work with, still
 searching...
 
 Thanks for your replies...
 

Take a look at procmail, http://www.procmail.org/. It contains a program
called formail to manipulate emails in mbox format. That's how evolution
stores local mail.
Also, you could define a filter. As action you could choose to call a
program or pipe the mail through a program.


-- 
thomas


___
evolution-list mailing list
evolution-list@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-list