Form Mailto Email Response Formatter

On my site, am using a Form (with mailto me). When I get the emails, the text is unformatted with &'s where returns should be and +'s between words. Comes to me as as an email attachment "postdata.att".  Any code out there that formats Form mailto responses?  Really only need format, save as, and print... but extras are good!!  Thanks Folks.

Jay
jkeehnAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
The text you are getting is in URL format...

Add the following code to a MODULE in your program then you can use the following function:

   Dim MyString As String
   MyString = URLdecode(EncodedString)

Cheers!



THE CODE:

    Function ReplaceInString(Source As String, TheString As String, TheReplaceString As String) As String
        Dim iVal As Integer
        Dim Workspace As String
        Workspace = Source
        iVal = 1
        Do
            iVal = InStr(iVal, Workspace, TheString, 1)
            If iVal = 0 Then Exit Do
            Workspace = Left$(Workspace, iVal - 1) + TheReplaceString + Mid$(Workspace, iVal + Len(TheString))
            iVal = iVal + 1
        Loop
        ReplaceInString = Workspace
    End Function
    Function URLdecode(Source As String) As String
        Dim lBuf As String
        Dim iVal As Long
        lBuf = ReplaceInString(Source, "+", " ")
        iVal = 1
        Do
            iVal = InStr(iVal, lBuf, "%")
            If iVal = 0 Then Exit Do
            lBuf = Left$(lBuf, iVal - 1) _
                + Chr$(CLng("&H" + Mid$(lBuf, iVal + 1, 2))) _
                + Mid$(lBuf, iVal + 3)
            iVal = iVal + 1
        Loop
        URLdecode = lBuf
    End Function
    Function URLencode(Source As String) As String
        Dim iVal As Long
        Dim lBuf As String
        Dim lArray As Variant
        lBuf = Source
        For Each lArray In Array("%", "&", "+", "~", "`", "!", "@", "#", "$", "^", "*" _
            , "(", ")", "-", "_", "=", "{", "[", "}", "]", "|", "\", ":", ";", "'", "<" _
            , ">", "?", ",", ".", "/", Chr$(34))
            lBuf = ReplaceInString(lBuf, CStr(lArray), "%" + Right$("0" + Hex(Asc(lArray)), 2))
        Next
        lBuf = ReplaceInString(lBuf, " ", "+")
        iVal = 0
        Do
            iVal = iVal + 1
            If iVal > Len(lBuf) Then Exit Do
            lArray = Mid$(lBuf, iVal, 1)
            If Asc(lArray) <= 31 Or Asc(lArray) >= 127 Then
                lBuf = ReplaceInString(lBuf, CStr(lArray), "%" + Right$("0" + Hex(Asc(lArray)), 2))
            End If
        Loop
        URLencode = lBuf
    End Function

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.