Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29755

Automatically Remove Border Around Warning in Email Body

$
0
0

I just suffered the same problem as described in the discussion linked to below, but with a catch: My organization has added border and highlighting to the warning banner added on all external emails.

Referenced discussion: Automatically Remove Warning in Email Body

I have developed code to strip the text out, which had to be split because the HTML source code uses different formatting for parts of the warning banner:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

     Item.HTMLBody = Replace(Item.HTMLBody, "Attention:", "")
     Item.HTMLBody = Replace(Item.HTMLBody, "This email originated from outside the university.", "")

End Sub

This leaves behind an empty banner with a brown border and tan highlighting. All of this is prepended to the message in HTML code, but I don't know how to get VBA to search at the HTML level. I would like to modify the above to instead strip the following HTML from the message body:

<div style=3D"border:solid #9C6500 1.0pt;padding:2.0pt 2.0pt 2.0pt 2.0pt">
<p class=3D"MsoNormal" style=3D"line-height:11.0pt;background:#FFEB9C"><b><=
span style=3D"font-size:9.0pt;color:#9C6500">Attention:</span></b><span sty=
le=3D"font-size:9.0pt;color:black"> This email originated from outside the =
university.<o:p></o:p></span></p>

Can VBA edit at the HTML level, i.e., modify the source? The first line of the HTML code is what needs to go, but I am struggling to find the right command.


Viewing all articles
Browse latest Browse all 29755

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>