[Mimedefang] html email
Alberto da Silva
alberto.dasilva at gmail.com
Wed Oct 6 05:07:48 EDT 2004
On Wed, 06 Oct 2004 16:34:13 +0800, Edmund <cc at belfordhk.com> wrote:
> Hi,
>
> I do not particularly appreciate html mail, so I figured
> I'd add something to the mimedefang-filter to get rid
> of the <html> </html> tags. As a start, to test it out,
> I tried the following code:
>
> if ($type eq "text/html") {
> my($output, $io);
> if ($io = $entity->open("r")){
> $output = $io->getline;
> $output =~ s/<(html|\/html)//igs;
> $io = $entity->open("w");
> $io->print($output);
> $io->close;
> }
> }
>
> This is in the filter() function.
>
> I haven't touched the mimedefang-filter in a while and haven't
> touched perl in a while as well, so I've probably done some
> ghastly mistake. (Why? Because it's not working...)
>
> Is there a book out that can help me?
>
> Thanks
>
> Edmund
See filter_end in /etc/mail/mimedefang-filter - there is example code
to do what you need
remove_redundant_html_parts($entity);
# I HATE HTML MAIL! If there's a multipart/alternative with both
# text/plain and text/html parts, nuke the text/html. Thanks for
# wasting our disk space and bandwidth...
# If you want to strip out HTML parts if there is a corresponding
# plain-text part, uncomment the next line.
# remove_redundant_html_parts($entity);
The man page mimedefang-filter is the best reference.
Alberto
More information about the MIMEDefang
mailing list