If you want to let Outlook auto save all attachments from the senders whose email addresses are in a specific domain, you can read this article. Here we will introduce a quick method to you.
Perhaps all staffs in your company use the email addresses which are in the same domain. Since you frequently send emails with various attachments to each other, you may wish Outlook to auto save the attachments from such emails. In this case, Outlook will be demanded to auto check the email’s sender domain and auto save attachments. Now, in the followings, we will share a piece of VBA code that is able to realize it with effortless ease.
Auto Save All Attachments from Senders in a Specific Domain
- At first, run Outlook VBA editor according to “How to Run VBA Code in Your Outlook“.
- Then, put the following code into an unused module.
Public WithEvents objInboxItems As Outlook.Items Private Sub Application_Startup() Set objInboxItems = Session.GetDefaultFolder(olFolderInbox).Items End Sub Private Sub objInboxItems_ItemAdd(ByVal Item As Object) Dim objMail As Outlook.MailItem Dim strSenderAddress As String Dim strSenderDomain As String Dim objAttachment As Attachment Dim strFolderPath As String Dim strFileName As String If Item.Class = olMail Then Set objMail = Item 'Get sender domain strSenderAddress = objMail.SenderEmailAddress strSenderDomain = Right(strSenderAddress, Len(strSenderAddress) - InStr(strSenderAddress, "@")) 'Change to the specific domain as per your needs If strSenderDomain = "datanumen.net" Then If objMail.Attachments.Count > 0 Then For Each objAttachment In objMail.Attachments 'Change the folder path where you want to save attachments strFolderPath = "E:\Attachments\" strFileName = objMail.Subject & " " & Chr(45) & " " & objAttachment.FileName objAttachment.SaveAsFile strFolderPath & strFileName Next End If End If End If End Sub
- After that, restart Outlook to activate this macro.
- Since then, every time when an incoming email gets into your inbox, Outlook will auto check the sender domain. If it is same as the predefined domain and it contains attachments, Outlook will auto save the attachments to specific local folder.
Never Open Attachments from Senders in Unknown Domains
It is advisable not to readily trust and download the attachments from those in unknown domains. It is because that they may come endowed with malware or viruses. Once you open them, Outlook file may be attacked. In other words, you may be subject to Outlook file corruption. At that time, even Scanpst is incapable of assisting you. Your only resort is either a more powerful tool or a specialized PST recovery service.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt mdf and outlook repair software products. For more information visit www.datanumen.com