![]() |
|
#1
|
|||
|
|||
|
Using Outlook 2013
Is it possible to create a rule for the following? I get a lot of email about newsletters and publications. If I do not read the email 48 hours after receiving it, I'd like it to be sent to the deleted folder. Is this possible? Your help is greatly appreciated.
|
|
#2
|
||||
|
||||
|
You can do it with a macro that runs at startup in the ThisOutlookSession module e.g.
Code:
Private Sub Application_Startup()
Dim oFolder As Folder
Dim oItem As MailItem
Dim i As Long
Set oFolder = Session.GetDefaultFolder(olFolderInbox)
For i = oFolder.Items.Count To 1 Step -1
If TypeName(oFolder.Items(i)) = "MailItem" Then
Set oItem = oFolder.Items(i)
If oItem.UnRead = True Then
If Format(oItem.ReceivedTime, "yyyymmdd") <= Format(Date - 3, "yyyymmdd") Then
Debug.Print CStr(oItem.ReceivedTime) & vbTab & oItem.Subject
'oItem.Delete 'restore after testing
End If
End If
End If
Next i
lbl_Exit:
Set oFolder = Nothing
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
Thank you!
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Setting a rule for incoming mails (both read and unread) - IMAP client | Tajak | Outlook | 0 | 08-22-2015 09:01 AM |
| Outlook : Delete an existing filtering rule using VBA | vadius | Outlook | 0 | 08-18-2011 03:53 AM |
| outlook 2003 custom email rule icons | pgasparr | Outlook | 0 | 06-29-2011 06:16 AM |
| delete email message via blackberry and have it delete on my pop3 and my outlook | Iamthestorm | Outlook | 2 | 10-28-2010 12:21 AM |
| outlook "Unread Email" folder automaticaly reads then dissapears emails | michaelrj9 | Office | 0 | 08-20-2010 03:59 PM |