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