G
Guest
is there a way to resend a message automaticaly after a few days
If so how can I do it
thx in advance
Darryl James
If so how can I do it
thx in advance
Darryl James
Sharad Naik said:Below code will resend a message every Monday when Outlook is started first
time on Monday.
(It will not work if Outlook was already started on a Sunday, and was never
closed and restarted on Mdonay.)
You need to do following first:
1. From below site download Outlook Redemption Developer Version.
http://www.dimastr.com/redemption/
Install Redemption. The 'redemption.dll' file will be installed in Program
Files\Redemption folder.
Start Visual Basic Editor in Outlook and Add reference to redemption.dll (It
will appear as SafeOutlook Libraray.)
This is necessary , otherwise, Outlook will display dialog box 'A Program is
Trying to send mail, do you
want to allow.' and one must manually click on 'Yes'. With Redemption
installed and reference added
in the project, the dialog box will not appear. The below code also will not
at all work, unless
you install redemption and add reference to it in the project.
2. I am assuming that the Subject of the mail you want to resend will
exactly be
"This is your Friendly Reminder" (w/o Quotation marks.). So First send the
message
manually with this Subject and save it in sent item folder.
OR if you already have a unique subject for the message sent and the message
is
already saved in sent item folders, then in the code below replace the
subject accordingly.
3. Add following code, in ThisOutlookSession class, in
Application.Startup() Procedure.
Dim olApp As Outlook.Application
Dim objContacts As Outlook.MAPIFolder
Dim objContact As Outlook.ContactItem
Dim objSentFold As Outlook.MAPIFolder
Dim objNameSpace As Outlook.NameSpace
Dim myMailItem As SafeMailItem
Dim myContactItem As Outlook.ContactItem
If Weekday(Date) = 2 Then
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objSentFold = objNameSpace.GetDefaultFolder(olFolderSentMail)
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
Set objContact = objContacts.Items.Find("[FileAs] = ""Resending Done""")
If TypeName(objContact) = "Nothing" Then
Set myContactItem = objContacts.Items.Add
myContactItem.FileAs = "Resending Done"
myContactItem.Title = "Resending Done"
myContactItem.Save
For Each Item In objSentFold.Items
If Item.Subject = "This is your Friendly Reminder" Then
Set myMailItem = CreateObject("Redemption.SafeMailItem")
myMailItem.Item = Item
myMailItem.Send
Exit For
End If
Next Item
End If
Else
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
Set objContact = objContacts.Items.Find("[FileAs] = ""Resending Done""")
If Not TypeName(objContact) = "Nothing" Then
objContact.Delete
End If
End If
4. Every Monday when the message is sent by above code, it will add a
contact item
in contacts folder with File As name = "Resending Done". This is to avoid
sending
of messages more than once on Monday, if outlook is restarted. The next day
this contact item will be automatically deleted.
5. The message being resent with above code, will not be sent immediately
after the
code is excecuted, but will be sent, when ever outlook does send receive as
per the
scheduled time specified in Outlook - Tools- Options. Also the message will
not
be displayed in Outbox and also will not be again saved in Sent Item folder.
Sharad
Darryl James said:is there a way to resend a message automaticaly after a few days
If so how can I do it
thx in advance
Darryl James
Darryl James said:no its not its various names set up with follow up flags
Sharad Naik said:Below code will resend a message every Monday when Outlook is started
first
time on Monday.
(It will not work if Outlook was already started on a Sunday, and was
never
closed and restarted on Mdonay.)
You need to do following first:
1. From below site download Outlook Redemption Developer Version.
http://www.dimastr.com/redemption/
Install Redemption. The 'redemption.dll' file will be installed in
Program
Files\Redemption folder.
Start Visual Basic Editor in Outlook and Add reference to redemption.dll
(It
will appear as SafeOutlook Libraray.)
This is necessary , otherwise, Outlook will display dialog box 'A Program
is
Trying to send mail, do you
want to allow.' and one must manually click on 'Yes'. With Redemption
installed and reference added
in the project, the dialog box will not appear. The below code also will
not
at all work, unless
you install redemption and add reference to it in the project.
2. I am assuming that the Subject of the mail you want to resend will
exactly be
"This is your Friendly Reminder" (w/o Quotation marks.). So First send
the
message
manually with this Subject and save it in sent item folder.
OR if you already have a unique subject for the message sent and the
message
is
already saved in sent item folders, then in the code below replace the
subject accordingly.
3. Add following code, in ThisOutlookSession class, in
Application.Startup() Procedure.
Dim olApp As Outlook.Application
Dim objContacts As Outlook.MAPIFolder
Dim objContact As Outlook.ContactItem
Dim objSentFold As Outlook.MAPIFolder
Dim objNameSpace As Outlook.NameSpace
Dim myMailItem As SafeMailItem
Dim myContactItem As Outlook.ContactItem
If Weekday(Date) = 2 Then
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objSentFold = objNameSpace.GetDefaultFolder(olFolderSentMail)
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
Set objContact = objContacts.Items.Find("[FileAs] = ""Resending
Done""")
If TypeName(objContact) = "Nothing" Then
Set myContactItem = objContacts.Items.Add
myContactItem.FileAs = "Resending Done"
myContactItem.Title = "Resending Done"
myContactItem.Save
For Each Item In objSentFold.Items
If Item.Subject = "This is your Friendly Reminder" Then
Set myMailItem =
CreateObject("Redemption.SafeMailItem")
myMailItem.Item = Item
myMailItem.Send
Exit For
End If
Next Item
End If
Else
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
Set objContact = objContacts.Items.Find("[FileAs] = ""Resending
Done""")
If Not TypeName(objContact) = "Nothing" Then
objContact.Delete
End If
End If
4. Every Monday when the message is sent by above code, it will add a
contact item
in contacts folder with File As name = "Resending Done". This is to avoid
sending
of messages more than once on Monday, if outlook is restarted. The next
day
this contact item will be automatically deleted.
5. The message being resent with above code, will not be sent immediately
after the
code is excecuted, but will be sent, when ever outlook does send receive
as
per the
scheduled time specified in Outlook - Tools- Options. Also the message
will
not
be displayed in Outbox and also will not be again saved in Sent Item
folder.
Sharad
Darryl James said:is there a way to resend a message automaticaly after a few days
If so how can I do it
thx in advance
Darryl James
Sharad Naik said:You can still use the code, instead of subject you can use EntryID property.
Every stored message has a unique EntryID which does not change unless the
item is moved.
First you need to find out the EntryID of each of those messages.
For this attached please find two files frm1.frm and Module_EntryID.bas
In Visual Basic Project, Click on import file and import the attached two
files
(a Form and a Module). The module has macro 'findEntryID'
Then in outlook close all open items (contacts / messages etc. all).
Open one of the message you want to resend, and run macro 'findEntryID'
It will display the EntryID, click on 'Copy to ClipBoard' button it will
copy the EntryID to clipboard and you can paste it in a notepad file.
Close the message and open the next messages you want to resend , one by
one and copy their EntryIDs.
(Note the code displays EntryID of active open item. Therefore make sure
that only one of the messages you want to resend is open at a time. Even
contact item or appointment item etc. should not be open.)
Then the code for resending the messages will be as under: (I showed
resending
up to 3 messages, you can extend it to as many items you want to resend.)
Replace "EntryID of msg1 .. 2 .." in below code with the above copied
EntryIDs
The below code should go in Application_Startup Procedure:
If Weekday(Date) = 2 Then
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objSentFold = objNameSpace.GetDefaultFolder(olFolderSentMail)
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
Set objContact = objContacts.Items.Find("[FileAs] = ""Resending Done""")
If TypeName(objContact) = "Nothing" Then
Set myContactItem = objContacts.Items.Add
myContactItem.FileAs = "Resending Done"
myContactItem.Title = "Resending Done"
myContactItem.Save
For Each Item In objSentFold.Items
If Item.EntryID = "EntryID of msg1" Then
Set myMailItem = CreateObject("Redemption.SafeMailItem")
myMailItem.Item = Item
myMailItem.Send
Set myMailItem = Nothing
End If
If Item.EntryID = "EntryID of msg2" Then
Set myMailItem = CreateObject("Redemption.SafeMailItem")
myMailItem.Item = Item
myMailItem.Send
Set myMailItem = Nothing
End If
If Item.EntryID = "EntryID of msg3" Then
Set myMailItem = CreateObject("Redemption.SafeMailItem")
myMailItem.Item = Item
myMailItem.Send
Set myMailItem = Nothing
End If
Next Item
End If
Else
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
Set objContact = objContacts.Items.Find("[FileAs] = ""Resending Done""")
If Not TypeName(objContact) = "Nothing" Then
objContact.Delete
End If
End If
Darryl James said:no its not its various names set up with follow up flags
Sharad Naik said:Below code will resend a message every Monday when Outlook is started
first
time on Monday.
(It will not work if Outlook was already started on a Sunday, and was
never
closed and restarted on Mdonay.)
You need to do following first:
1. From below site download Outlook Redemption Developer Version.
http://www.dimastr.com/redemption/
Install Redemption. The 'redemption.dll' file will be installed in
Program
Files\Redemption folder.
Start Visual Basic Editor in Outlook and Add reference to redemption.dll
(It
will appear as SafeOutlook Libraray.)
This is necessary , otherwise, Outlook will display dialog box 'A Program
is
Trying to send mail, do you
want to allow.' and one must manually click on 'Yes'. With Redemption
installed and reference added
in the project, the dialog box will not appear. The below code also will
not
at all work, unless
you install redemption and add reference to it in the project.
2. I am assuming that the Subject of the mail you want to resend will
exactly be
"This is your Friendly Reminder" (w/o Quotation marks.). So First send
the
message
manually with this Subject and save it in sent item folder.
OR if you already have a unique subject for the message sent and the
message
is
already saved in sent item folders, then in the code below replace the
subject accordingly.
3. Add following code, in ThisOutlookSession class, in
Application.Startup() Procedure.
Dim olApp As Outlook.Application
Dim objContacts As Outlook.MAPIFolder
Dim objContact As Outlook.ContactItem
Dim objSentFold As Outlook.MAPIFolder
Dim objNameSpace As Outlook.NameSpace
Dim myMailItem As SafeMailItem
Dim myContactItem As Outlook.ContactItem
If Weekday(Date) = 2 Then
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objSentFold = objNameSpace.GetDefaultFolder(olFolderSentMail)
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
Set objContact = objContacts.Items.Find("[FileAs] = ""Resending
Done""")
If TypeName(objContact) = "Nothing" Then
Set myContactItem = objContacts.Items.Add
myContactItem.FileAs = "Resending Done"
myContactItem.Title = "Resending Done"
myContactItem.Save
For Each Item In objSentFold.Items
If Item.Subject = "This is your Friendly Reminder" Then
Set myMailItem =
CreateObject("Redemption.SafeMailItem")
myMailItem.Item = Item
myMailItem.Send
Exit For
End If
Next Item
End If
Else
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
Set objContact = objContacts.Items.Find("[FileAs] = ""Resending
Done""")
If Not TypeName(objContact) = "Nothing" Then
objContact.Delete
End If
End If
4. Every Monday when the message is sent by above code, it will add a
contact item
in contacts folder with File As name = "Resending Done". This is to avoid
sending
of messages more than once on Monday, if outlook is restarted. The next
day
this contact item will be automatically deleted.
5. The message being resent with above code, will not be sent immediately
after the
code is excecuted, but will be sent, when ever outlook does send receive
as
per the
scheduled time specified in Outlook - Tools- Options. Also the message
will
not
be displayed in Outbox and also will not be again saved in Sent Item
folder.
Sharad
is there a way to resend a message automaticaly after a few days
If so how can I do it
thx in advance
Darryl James