outlook 2007 rules to export mail as html


I would like to set a rule that message from a certain sender are automatically saved/exported as html in aan dir on my hard disk. How can I do this?

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.

You can export mail to a public folder that exists in Outlook or on your server with a standard rule.
DennieAuthor Commented:
can you please write the steps. I can't find it
Open Outlook
Click on Tools
Rules and Alerts
New Rule
Move messages from someone to a folder

And you click next to select the criteria for the email messages you want to send to a folder, whether it's from a person, a group or with certain words in the subject line, etc.  But you need a public folder created where you want these to go.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

DennieAuthor Commented:
Yes, but I want to export them to a directory outside outlook in HTML format... that doesn't seem possible with your steps
DennieAuthor Commented:
Just as the 'save as' button does when viewing an e-mail
I don't know of any way to make that happen unless the rules do that.  Sorry!
You cannot create a rule for something which is outside the outlook. Outlook rules only work within Outlook and they run only when outlook is open. What you are looking for is not possibe.
DennieAuthor Commented:
The rule isn't for something outside outlook!

I just want to simulate the save as button (which is available in outlook) I'm sure it's possible. Perhaps not as easy as just simply clicking the new rule button ;)
DennieAuthor Commented:
Perhaps a little custom script?
Hi again, yes I can help. You will need to create the rule for the sender then run the script below. You will need to modify the folders to suit. I use this to save as text files but have modified it here to save as html, I don't know if the outputted html will be to your liking, you will have to check all that. You may or may not wish to delete the original email, it should be fairly obvious how to turn this on or off.

Option Explicit
Sub Save_Email_as_html(mItem As Outlook.MailItem)
    Dim StrSubject      As String
    Dim StrName         As String
    Dim StrFile         As String
    Dim strFolderPath   As String
    Dim StrSaveFolder   As String
    Dim myOLApp         As Outlook.Application
    Dim FSO             As Object

    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set myOLApp = Outlook.Application

    strFolderPath = "C:\Temp"
    If MsgBox("Email item " & """" & mItem & """" & vbCrLf & _
    "Will be output as html to: " & strFolderPath, vbQuestion + vbOKCancel) = vbCancel Then
    GoTo Exitsub:

    End If

        StrSaveFolder = "C:\Temp" & "\"

        If Not FSO.FolderExists(strFolderPath) Then
            FSO.CreateFolder (strFolderPath)
        End If
            StrSubject = mItem.Subject
            StrName = StripIllegalChar(StrSubject)
            StrFile = StrSaveFolder & StrName
            StrFile = StrFile & ".html"
            mItem.SaveAs StrFile, olHTML
            'Delete original email
End Sub
Private Function StripIllegalChar(StrInput)
    Dim RegX            As Object
    Set RegX = CreateObject("vbscript.regexp")
    RegX.Pattern = "[\" & Chr(34) & "\!\@\#\$\%\^\&\*\(\)\=\+\|\[\]\{\}\`\'\;\:\<\>\?\/\,]"
    RegX.IgnoreCase = True
    RegX.Global = True
    StripIllegalChar = RegX.Replace(StrInput, "")

    Set RegX = Nothing
End Function

Open in new window


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
DennieAuthor Commented:
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

From novice to tech pro — start learning today.