[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Modify http links while generating archives?
On June 10, 2009 at 10:02, David Gibbs wrote:
> I'm not a perl coder ... can anyone give me some hints on how to have mhonarc
> modify links, to external sites, that are generated so I can add redirects o
> r tracking code (like Google analytics)?
Perl coding will be required to do what you want.
> I'm assuming it will have to be done in a mime filter module.
Actually, it might be better to leverage the API mechanism so
you can process all message types, not just plain text ones. For
example, I'm guessing you will want to rewrite URLs for HTML
mail messages also.
If you take the MIME filter route, you would have to develop
a custom filter for all possible MIME types that can contain
external links, not fun.
If you register a $mhonarc::CBMessageBodyRead API callback function,
you can centrally post-process the HTML generated by the MIME filters.
Therefore, you only need to parse out HTML tags that can contain
external links (e.g. <a>, <img>, et.al.).
How to use the API is documented in an appendix section of the
[Index of Archives]