none
move a mail in the Outbox programatically. RRS feed

  • Question

  • Hi,

    I still want to send a mail after doing many task. Can i move it into the outbox? And maybe inform Outlook when it going to be send.

    Thanks.

    Monday, May 4, 2015 4:31 PM

Answers

  • Hi Aurelien,

    >>Thanks but i don't want to display the show progress I want to add a new task in it. Can i do that?<<

    Did you want to add some custom code before the mail item was sent. If I understood correctly, we can use Application.ItemSend Event to achieve the goal.

    You can get more detail about this event from link below:
    https://msdn.microsoft.com/en-us/library/office/ff865076.aspx

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 12, 2015 9:47 AM
    Moderator

All replies

  • Hello Aurelien,

    Moving items to the Outbox folder is not enough for sending... Why do you need to place Outlook items in the Outbox folder?

    You need to use the Send method of Outlook items to send the e-mail message. But to move the item into another folder you need to use the Move method. See How to: Programmatically Move Items in Outlook for more information. 


    Monday, May 4, 2015 4:44 PM
  • Outbox is just an eye candy. A message can be sent from any folder, it is just Outlook (both UI and Object Model) move the message there when it is being sent.

    Other than that, Outbox is just a regular folder that can have messages. Moving anything there will not automatically send it.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, May 4, 2015 5:17 PM
  • "Outbox is just an eye candy". I want to simulate this "eye candy" because i want to keep the user UX while i send a mail. That also why i want inform Outlook when it going to be send. I also want to add my task in the "Show progress" Windows.

    Thanks.

    Tuesday, May 5, 2015 7:32 AM
  • The Outlook object model doesn't provide any method or property for displaying the "Show Progress" window. However, you may try to use the Start method of the SyncObject class to begin synchronizing a user's folders using the specified Send\Receive group. For example:

    Public Sub Sync() 
     Dim nsp As Outlook.NameSpace 
     Dim sycs As Outlook.SyncObjects 
     Dim syc As Outlook.SyncObject 
     Dim i As Integer 
     Dim strPrompt As Integer 
     Set nsp = Application.GetNamespace("MAPI") 
     Set sycs = nsp.SyncObjects 
     For i = 1 To sycs.Count 
    Set syc = sycs.Item(i) 
    strPrompt = MsgBox( _ 
     "Do you wish to synchronize " & syc.Name &"?", vbYesNo) 
    If strPrompt = vbYes Then 
     syc.Start 
    End If 
     Next 
    End Sub

    As I wrote earlier, you can use the Move method of Outlook items to move items into the outbox folder programmatically. Or just create a new item in the outbox folder directly - use the outboxFolder.Items.Add method to create a new one.

    Tuesday, May 5, 2015 10:44 AM
  • All of that will happen if you call MailItem.Send

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, May 5, 2015 1:58 PM
  • Thanks but i don't want to display the show progress I want to add a new task in it. Can i do that?
    Tuesday, May 5, 2015 4:06 PM
  • What task are you talking about? It looks like you just need to call the Send method of the MailItem class. Have you tried doing so?

    The Outlook object model doesn't provide any property or method for managing the "Send/Recieve" window.

    Tuesday, May 5, 2015 5:48 PM
  • Hi Aurelien,

    >>Thanks but i don't want to display the show progress I want to add a new task in it. Can i do that?<<

    Did you want to add some custom code before the mail item was sent. If I understood correctly, we can use Application.ItemSend Event to achieve the goal.

    You can get more detail about this event from link below:
    https://msdn.microsoft.com/en-us/library/office/ff865076.aspx

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 12, 2015 9:47 AM
    Moderator