Remove clickable hyperlinks in email body

Peter H. Lemieux mailscanner at
Thu Apr 9 17:03:40 UTC 2020

This kind of thing is better handled by procmail, a replacement mail 
delivery agent that allows you to create mail-handling "recipes."  One 
type of recipe is a filter that can be applied to the text of a message. 
  Here's a simple filter I wrote that uses sed to disarm links by 
replacing the "<a" and "/a>" tags with "<axxx" and "/xxxa" respectively.

| sed 's%<a%<xxxa%g' | sed 's%/a>%/xxxa%g'

The :0 denotes the beginning of a recipe, and the "f" switch tells it 
act as a filter.  The message is passed through the two sed instances 
then delivered normally.

You can install procmail using your system's package manager, if you do 
not have it already.  You can place system-wide recipes in the file 
called /etc/procmailrc, and they will be applied to every delivered 
message.  Users can have their own individual .procmailrc files as well. - documentation for writing 
recipes; very extensive and dense - much easier introduction 
through the use of common examples


On 4/9/20 11:26 AM, James Yu Wang wrote:
> Hello,
> Is there a way to remove clickable hyperlinks in message body and still 
> keep the whole message in HTML format? Right now we convert all HTML to 
> Text format. Some emails are hard to read in text mode.

More information about the MailScanner mailing list