Monday, November 08, 2010 at 12:04 AM.

system.verbs.builtins.radio.aggregator.mailAggregator.postScanCallback

<<Changes
	<<11/5/02; 11:31:07 AM by DW
		<<Add support for templates.
	<<10/10/02; 11:22:46 AM by DW
		<<Created. Because <descriptions> in RSS can contain HTML markup, the emails must go out with a mimetype of text/html, unless we're going to write a heroic parser to clean up the text. 
if user.radio.prefs.mailAggregator.enabled {
	local (htmltext = "", indentlevel = 0);
	on add (s) {
		htmltext = htmltext + (string.filledstring ("\t", indentlevel) + s + "\r\n");};
	local (adrservice, adritem, dashes = string.filledstring ("-", 70), ct = 1);
	for adrservice in @system.temp.radio.mailAggregator {
		add (string.replace (string (user.radio.prefs.mailAggregator.templateFeedTitle), "<%title%>", adrservice^.title));
		for adritem in @adrservice^.items {
			local (s = string (user.radio.prefs.mailAggregator.templateItem));
			s = string.replace (s, "<%count%>", ct++);
			s = string.replace (s, "<%title%>", adritem^.title);
			add (s)}};
			<<add ("<tr><td align=\"right\" valign=\"top\">" + ct++ + ". </td><td>" + adritem^.title + "</td></tr>")
	
	local (mailtext = string (user.radio.prefs.mailAggregator.template));
	mailtext = string.replace (mailtext, "<%bodytext%>", htmltext);
	mailtext = string.replace (mailtext, "<%username%>", user.prefs.name);
	
	tcp.sendmail (user.radio.prefs.mailAggregator.toMailAddress, user.radio.prefs.mailAggregator.mailSubject, mailtext, user.radio.prefs.mailAggregator.fromMailAddress, mimeType:"text/html")}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.