P
paresh
Hi,
I have written one add-in which replaces [a-zA-z]#[0-9] or
[a-zA-z]#[0-9]#[0-9] with the hyperlinks. It is working fine(attached portion
of code). I found the two problems.
1. The hyperlink (in format of "http://mylink/Q/") is getting converted
into clickable link if I use objSafeMail.Body instead of objSafeMail.RTFBody
in my code but usage of objSafeMail.Body converts mail format to plain text.
2. If I use objSafeMail.RTFBody then hyperlink is becoming non-clickable.
Could any one suggest me if in Option#1 (while using objSafeMail.Body) it is
possible to persist email format as it is OR in Option#2 is it possible to
make replaced hyperlink to clickable,
Code:
Private Sub objMailItem_Send(Cancel As Boolean)
Const Link = "http://mylink/Q/"
Const REQUEST_PATTERN = "([a-zA-Z]+)(\#[0-9]+){1,2}(?!\#)\b"
Set oRE = CreateObject("VBScript.Regexp")
With oRE
.IgnoreCase = True
.Global = True
.MultiLine = True
.Pattern = REQUEST_PATTERN
End With
objMailItem.BodyFormat = olFormatHTML
objMailItem.Save
Dim objSafeMail As Redemption.SafeMailItem
Set objSafeMail = CreateObject("Redemption.SafeMailItem")
objSafeMail.Item = objMailItem
Set oMatches = oRE.Execute(objSafeMail.Body)
objSafeMail.RTFBody = oRE.Replace(objSafeMail.RTFBody, Link &
"$1/$&")
objSafeMail.Save
For Each omatch In oMatches
objSafeMail.RTFBody = Replace(objSafeMail.RTFBody, "/" &
omatch.SubMatches(0) & "#", "/")
objSafeMail.Save
Next
End Sub
Thanks.
I have written one add-in which replaces [a-zA-z]#[0-9] or
[a-zA-z]#[0-9]#[0-9] with the hyperlinks. It is working fine(attached portion
of code). I found the two problems.
1. The hyperlink (in format of "http://mylink/Q/") is getting converted
into clickable link if I use objSafeMail.Body instead of objSafeMail.RTFBody
in my code but usage of objSafeMail.Body converts mail format to plain text.
2. If I use objSafeMail.RTFBody then hyperlink is becoming non-clickable.
Could any one suggest me if in Option#1 (while using objSafeMail.Body) it is
possible to persist email format as it is OR in Option#2 is it possible to
make replaced hyperlink to clickable,
Code:
Private Sub objMailItem_Send(Cancel As Boolean)
Const Link = "http://mylink/Q/"
Const REQUEST_PATTERN = "([a-zA-Z]+)(\#[0-9]+){1,2}(?!\#)\b"
Set oRE = CreateObject("VBScript.Regexp")
With oRE
.IgnoreCase = True
.Global = True
.MultiLine = True
.Pattern = REQUEST_PATTERN
End With
objMailItem.BodyFormat = olFormatHTML
objMailItem.Save
Dim objSafeMail As Redemption.SafeMailItem
Set objSafeMail = CreateObject("Redemption.SafeMailItem")
objSafeMail.Item = objMailItem
Set oMatches = oRE.Execute(objSafeMail.Body)
objSafeMail.RTFBody = oRE.Replace(objSafeMail.RTFBody, Link &
"$1/$&")
objSafeMail.Save
For Each omatch In oMatches
objSafeMail.RTFBody = Replace(objSafeMail.RTFBody, "/" &
omatch.SubMatches(0) & "#", "/")
objSafeMail.Save
Next
End Sub
Thanks.