l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
January 6: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2010 Oct 24 12:50

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] procmail question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] procmail question



On 10/23/2010 06:01 PM, Chanoch (Ken) Bloom wrote:
> A quick googling suggests it doesn't know how to do it in-process, but
> you could use the GNU mailutils pipe extension to do such things (in
> conjunction with a program like formail or reformail, or of course a
> spam filter like spamassassin). You can look in /usr/lib/mailutils/ to
> see what extensions are available, and you can write your own as a
> shared library.

	Thanks for the additional info. This support what I thought I
	was seeing. And at one time Procmail/formail was combine
	together as src in a tar file. I'm not sure if this is still
	the case.


>> 	Maildrop was also mention, I only took a quick and dirty look
>> 	at it. Can it also solve the above questions?
> 
> I don't actually use Sieve for my email. I suggested it because it was a
> standard.
> 
> I've used maildrop in the past (rewriting headers, and running spam
> filters with its xfilter command), and my mail filters looked like (for
> example)
> 
>     if (/Mailing-List: list some.mailinglist.org <mailto:NAJSA@yahoogroups.com>; contact/:h ||	\
>         /From:.*foo@bar.com/ || \
>         /From:.*bar@foo.com/ || \
>         /From:.*baz@bar.com/ || \
>         /From:.*@some.domain.org/ || \
>         /Mailing-List: list some-other-mailinglist@yahoogroups.com; / || \
>         /From:.*afinal@email.org/ )
>     {
>           to $MAILBOX/.util.probably-spam
>     }
> 
>     # spam filtering
>     if ($SIZE < 1048576)
>     {
>        xfilter 'spamassassin'
>     }
> 
>     if (/^X-Spam-Status: Yes/)
>     {
>        xfilter 'reformail -I"Status: RO"'
>        to '| $HOME/bin/maildir-deliverread $MAILBOX/.util.probably-spam'
>     }
> 
> 
> I didn't like this (I didn't find it concise enough), and the
> backslashes as line continuations and mandatory braces annoyed me. (I
> was always forgetting them when I made changes, and it would break my
> email for days on end.)

	And once again you supported what I thought I found in my
	short research. I also find maildrop syntax to not be as
	clear as what I would like. I also don't like having to
	escape things when there really is no good reason for it.

	I think there is is room for a new filter program. I have
	thought of a syntax which might be more like a C program.
	My thought was along the line of:

	if ((header_to(name) == "" || header_to(name) != "Tony")
		&& header_to(email) == "cratz@hematite.com" &&
		(header_from(name) != "Tony" && header_from(email) ==
		"cratz@hematite.com"))
	{
		log("Message not sent by Tony");
		next; /* wait for next message */
	} else {
		if (header_get("X-tony-really-sent:") == "secret_key") {
			log("tony sent this message")
			save_message($Tonysent");
			/* save in the tony sent mail box */
		}
	}


	This is not fully flushed out but it gives an idea of kind
	of what I was thinking. There would be a set of functions
	which deals with the envelop, body and attachments. Such as:

Return a structure which contain char *real_name and
	char *email_name

	envelop_header_to()
	envelop_header_from()
	header_to()
	header_from()

	Return a char *value
	header_messageid()
	header_subject()

	header_date_tm() - return a tm struct of the time
	header_date_sec() - returns times in seconds
	
	header_receive() - return array of structures of receive values

	header_list() - return an array headers names (could be used
	to see what headers are contained in messages.

	header_get(matchstring) - return string value of header which
	matches the match string.

	$attach_num - number of attachment
	$attach_size($num)
	$body_size
	$total_message_size

	attachments($num) - return array of info about attachment
	attach_scan($num, string) - matches string in attachment
	(need to think more about this one)

	body_text_html - returns if the body is plain text or html
	body_html(string) - scans the html output for strings
	body_html_code(string) - scan the html_code for string
	body_text(string) - matchings string in body. Newlines are
	converted to what space.

	replace_header("To:", replacement_string)
	mail_message($new_header_altered_message_with_body)
	

	Again this is just the first pass of an idea. I think if the
	syntax was correctly developed it would be clear to understand
	and also be easy to implement Sieve style rules for filtering.

	I'm not ready yet to say it is ready for development. It is
	still early in the thought process. In the mean time, I think
	I will continue to use Procmail until I can find an even better
	program which will do the same things (even though I hate the
	syntax of Procmail).
	


							Tony
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!