Remove clickable hyperlinks in email body

yuwang yuwang at cs.fsu.edu
Thu Apr 9 22:43:57 UTC 2020


Peter,

This is a good suggestion. We do use procmail on our Linux mail 
delivery. We also have Exchange mail delivery but the user base is 
small.

I just did some tests. Replacing "<a href=" with "<" suits our case. It 
allows URL to be displayed but not clickable (don't know why it doesn't 
work on all emails). Users can copy/paste if they want to visit the 
link.

Thank you.

James

On 2020-04-09 13:03, Peter H. Lemieux wrote:
> 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.
> 
> :0f
> | 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.
> 
> https://linux.die.net/man/5/procmailrc - documentation for writing
> recipes; very extensive and dense
> 
> https://linux.die.net/man/5/procmailex - much easier introduction
> through the use of common examples
> 
> Peter
> 
> 
> 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