Note: The other languages of the website are Google-translated. Back to English

Como remover automaticamente os anexos após o envio de emails dos itens enviados?

Ao enviar e-mail com alguns anexos, os anexos serão armazenados com os e-mails na pasta de itens enviados por padrão. Para reduzir o tamanho do seu arquivo PST, você pode remover os anexos dos itens enviados automaticamente após o envio dos e-mails. Neste artigo, vou falar sobre essa tarefa no Outlook.

Remova automaticamente os anexos após o envio de e-mails dos itens enviados

Remova automaticamente os anexos após o envio de e-mails dos itens enviados

O seguinte código VBA pode ajudá-lo a excluir automaticamente os anexos após o envio de e-mails de seu Outlook, faça o seguinte:

1. Segure o ALT + F11 chaves para abrir o Microsoft Visual Basic para Aplicações janela.

2. Na série Microsoft Visual Basic para Aplicações janela, clique duplo Esta sessão do Outlook de Projeto1 (VbaProject.OTM) painel para abrir o modo e, em seguida, copie e cole o código a seguir no módulo em branco.

Código VBA: remover automaticamente os anexos após o envio de e-mails dos itens enviados:

Public WithEvents SentMailItems As Outlook.Items
    Private Sub Application_Startup()
    Set SentMailItems = Outlook.Application.Session.GetDefaultFolder(olFolderSentMail).Items
    End Sub
    Sub SentMailItems_ItemAdd(ByVal Item As Object)
    Dim xSentMail As Outlook.MailItem
    Dim xAttachments As Outlook.Attachments
    Dim xAttachment As Outlook.Attachment
    Dim xAttachmentInfo As String
    On Error Resume Next
    If Item.Class = olMail Then
       Set xSentMail = Item
    End If
    Set xAttachments = xSentMail.Attachments
    For i = xAttachments.Count To 1 Step -1
        Set xAttachment = xAttachments.Item(i)
        xAttachmentInfo = "<HTML><BODY>" & xAttachment.DisplayName & _
                          "</BODY></HTML>" & vbCrLf & xAttachmentInfo
    xSentMail.HTMLBody = "<HTML><BODY><font color=#FF0000>Attachment Removed: </font><br/></BODY></HTML>" & _
                         xAttachmentInfo & "<HTML><BODY><br/></BODY></HTML>" & xSentMail.HTMLBody
End Sub

3. After inserting the above code, please restart your Outlook to make the code take effect.

4. From now on, when you send emails with attachments, the attachments will be deleted automatically from the sent items as following screenshot shown:

Note: This code is only available to the default data account.

Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations

Follow Us

Copyright © 2009 - | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL