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

Discussion in 'Microsoft Outlook VBA Programming' started by shawnho, Jun 15, 2012.

  1. shawnho

    shawnho

    Joined:
    Jun 15, 2012
    Messages:
    2
    Likes Received:
    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
     
    shawnho, Jun 15, 2012
    #1
    1. Advertisements

  2. shawnho

    shawnho

    Joined:
    Jun 15, 2012
    Messages:
    2
    Likes Received:
    0
    Could anyone provide some advices please? I am run out of solutions! :bow:
     
    shawnho, Jun 18, 2012
    #2

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shane Clarke

    Re: Choose into which folder a sent mail is put each time a mail is sent

    Shane Clarke, Jul 9, 2003, in forum: Microsoft Outlook VBA Programming
    Replies:
    0
    Views:
    927
    Shane Clarke
    Jul 9, 2003
  2. Jack

    Sent redemption message not added to Sent Items folder

    Jack, Apr 21, 2005, in forum: Microsoft Outlook VBA Programming
    Replies:
    3
    Views:
    967
    Guest
    Apr 22, 2005
  3. Google-Albert@CIM-Team.com

    Add mail message to draft folder of any outlook account?

    Google-Albert@CIM-Team.com, May 6, 2005, in forum: Microsoft Outlook VBA Programming
    Replies:
    1
    Views:
    636
    Guest
    May 6, 2005
  4. Guest

    Problem with Sent Items/Redemption

    Guest, Jan 10, 2006, in forum: Microsoft Outlook VBA Programming
    Replies:
    10
    Views:
    1,541
    Guest
    Jan 12, 2006
  5. ramserp
    Replies:
    0
    Views:
    666
    ramserp
    Apr 1, 2010
Loading...

Share This Page