Sent Mail won't be removed from Draft for Redemption with Outlook 2010

Joined
Jun 15, 2012
Messages
2
Reaction score
0
I try to follow the faq to send emails using redemption. I test the code using Outlook 2010 and GMail Pop3/smtp account. I use excel vba to call the outlook object without the active explorer. I notice that if I rem the SafeItem.save, my email would be sent but still stay at the draft folder. The sent one was never moved into the sent folder. After I checking if the sending was successful, the one in the draft folder would be sent again. In the end, I got two identical emails but with a different sent time stamp. Could anyone explain the mechanism?

I also test the same code on an Outlook 2007 machine but using an Exchange server account. My email simply stays at the draft folder without going anywhere. I try use MAPIUtils.DeliveryNow but still not working. Thanks for pointing out any direction in advance.

My code is attached below.


Dim Application As Outlook.Application
Dim NameSpace As Outlook.NameSpace
Dim SafeItem, oItem, Utils
Dim Btn As CommandBarControl
Dim sRecipient As Variant
Dim recipient As Outlook.recipient
Dim Sync As Outlook.SyncObject

Set Application = CreateObject("Outlook.Application")
Set NameSpace = Application.GetNamespace("MAPI")
NameSpace.Logon


Set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of Redemption.SafeMailItem
Set oItem = Application.CreateItem(olMailItem) 'Create a new message
SafeItem.Item = oItem 'set Item property
'Set SafeItem.SaveSentMessageFolder = NameSpace.GetDefaultFolder(olFolderSentMail)

With SafeItem
For Each sRecipient In Recipients
Set recipient = .Recipients.Add(sRecipient)
'recipient.Type = olTo
Next sRecipient
'For Each sRecipient In CCTo
' Set recipient = SafeItem.Recipients.Add(sRecipient)
' recipient.Type = olCC
'Next sRecipient
.Recipients.ResolveAll
.Subject = Subject
.HTMLBody = SafeItem.Body & Content
.Save
'.Display
.Send
End With
''''''''''''''''''''''''''''''''''''
' (1) Use Sync object (this method works for outlook 2010 with gmail pop3 account)
'''''''''''''''''''''''''''''''''''
'Sync object
Set Sync = NameSpace.SyncObjects.Item(1)
Sync.Start

Set Application = Null
Set SafeItem = Nothing
Set oItem = Nothing
Set recipient = Nothing
Set Sync = Nothing
Set Utils = Nothing
Set Btn = Nothing
 
Back
Top