• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 621
  • Last Modified:

Outlook send selected email as attachment and delete

I'm looking for a way to automaticaly send email items in my inbox as an attachment to a fixed address. Also I 'd like to creat a button on my toolbar and tie this action to it.

Example: I select a few items in my inbox and then click the toolbar button. Those selected items are then inserted in to a new email. That new email is sent to a somthing@somthing.com. After the email is sent, the selected emails are deleted.

I'm using Outlook 2010
0
Erik Curtis
Asked:
Erik Curtis
1 Solution
 
Naser GabajCommented:
Hi

I never try it before, but I believe this tool can do the job for you

http://www.lbetoolbox.com/scheduleemail.htm

Good luck
0
 
JonMnyCommented:
copy code below into a macro

This page will show you how to add a button to the toolbar

http://www.howto-outlook.com/howto/macrobutton.htm


Private Declare Function GetTempPath Lib "kernel32" _
         Alias "GetTempPathA" (ByVal nBufferLength As Long, _
         ByVal lpBuffer As String) As Long
      Private Declare Function GetTempFileName Lib "kernel32" _
         Alias "GetTempFileNameA" (ByVal lpszPath As String, _
         ByVal lpPrefixString As String, ByVal wUnique As Long, _
         ByVal lpTempFileName As String) As Long
      Private Function CreateTempFile(sPrefix As String) As String
         Dim sTmpPath As String * 512
         Dim sTmpName As String * 576
         Dim nRet As Long
         nRet = GetTempPath(512, sTmpPath)
         If (nRet > 0 And nRet < 512) Then
            nRet = GetTempFileName(sTmpPath, sPrefix, 0, sTmpName)
            If nRet <> 0 Then
               CreateTempFile = Left$(sTmpName, _
                  InStr(sTmpName, vbNullChar) - 1)
            End If
         End If
      End Function
Sub GetSelected()
Dim messages()
Dim mail As MailItem
Dim tmpPath
Dim currentMail As MailItem
If Not IsEmpty(ActiveExplorer.Selection) Then
    For Each CurrentItem In ActiveExplorer.Selection
        If CurrentItem.Class = olMail Then
            If mail Is Nothing Then Set mail = Application.CreateItem(olMailItem)
                counter = counter + 1
                Set currentMail = CurrentItem
                tmpPath = CreateTempFile("OL")
                currentMail.SaveAs tmpPath, olMSG
                mail.Attachments.Add tmpPath
            End If
            CurrentItem.Delete
 
    Next
 
End If
mail.BodyFormat = olFormatHTML
mail.Subject = "Emails forwarded"
mail.Body = "emails attached"
mail.To = "yourEmail@ou.com"
mail.Send
msgbox "Finished"
end sub

Open in new window

0
 
Erik CurtisAuthor Commented:
This works just as it should!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now