You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by co...@spamassassin.apache.org on 2005/03/07 07:01:13 UTC

[SpamAssassin Wiki] Updated: PluginWritingTips

   Date: 2005-03-06T22:01:12
   Editor: JustinMason
   Wiki: SpamAssassin Wiki
   Page: PluginWritingTips
   URL: http://wiki.apache.org/spamassassin/PluginWritingTips

   adding note about new functionality

Change Log:

------------------------------------------------------------------------------
@@ -2,7 +2,7 @@
 
 These tips may be useful to developers of SpamAssassin plugins.
 
-== Setting Output Headers ==
+== Setting Output Headers and Custom Template Tags ==
 
 If you want to add custom headers in the rewritten mail message, the {{{Mail::SpamAssassin::PerMsgStatus::set_tag()}}} API is the way to do it.
 
@@ -26,3 +26,13 @@
 }}}
 
 You can also get the value of a tag using the {{{Mail::SpamAssassin::PerMsgStatus::get_tag()}}} API from inside a plugin, although note that some of the tags will not be filled in until after the scan completes, and may not be available.
+
+In SpamAssassin 3.1.0 onwards, you can use C<set_tag> and provide a subroutine reference, like so:
+
+{{{
+  my $data = "hello world";
+  $permsgstatusobject->set_tag ("MYTAG", sub {
+        return $data;
+      });
+}}}
+