none
Equivalent of office 2003 MailItem.Send event and event handler in office 2013 C# RRS feed

  • Question

  • Hi,

    what is the equivalent of office 2003 MailItem.Send event and event handler in office 2013 C#?

    Legacy code example-

    Private WithEvents pAntwoord As outlook.MailItem

    Thanks,

    • Moved by Kristin Xie Tuesday, June 9, 2015 7:34 AM move to appropriate forum
    Monday, June 8, 2015 11:54 AM

Answers

  • The Outlook object model has not been changed since Office 2003 (regarding the Send event). So, you can continue using the Send event of the MailItem class. The event is fired when the user selects the Send action for an item, or when the Send method is called for the item, which is an instance of the parent object.

    Also you may find the ItemSend event of the Application class helpful. It is fired whenever an Microsoft Outlook item is sent, either by the user through an Inspector (before the inspector is closed, but after the user clicks the Sendbutton) or when the Send method for an Outlook item, such as MailItem, is used in a program.

    Tuesday, June 9, 2015 7:48 AM

All replies

  • System.Net.Mail is used in C# to send emails via SMTP server.

    If you looking to implement an event handler like SendCompleted on AsyncSend, you can check  this example on msdn.


    Fouad Roumieh




    Monday, June 8, 2015 12:08 PM
  • i am looking for implementing the mail item send event handler.
    Monday, June 8, 2015 12:15 PM
  • The Send is a method and does not raise events. You can implement the SendCompleted on the SMTPClient as explained in the example of the previous post.

    Fouad Roumieh

    Monday, June 8, 2015 12:25 PM
  • Hello,

    For SMTP there is OnComplete which is the only event.

    See sample

    http://www.systemnetmail.com/faq/4.6.aspx

    If you like myself or another moderator can move this question to the Outlook for developer forum for better support.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.


    Monday, June 8, 2015 7:58 PM
  • Hi,

    I m looking for office outlook event not smtp.

    Thanks,

    Tuesday, June 9, 2015 3:28 AM
  • Hi,

    I m looking for office outlook event not smtp.

    Thanks,

    I'm not sure what  do you mean by "Office Outlook event", I suggest to move this to Outlook for Developers forum as advised by Kevin.

    But even for this, you should provide more details on what you trying to achieve, if you want to get quicker & helpful answers.


    Fouad Roumieh

    Tuesday, June 9, 2015 6:00 AM
  • The Outlook object model has not been changed since Office 2003 (regarding the Send event). So, you can continue using the Send event of the MailItem class. The event is fired when the user selects the Send action for an item, or when the Send method is called for the item, which is an instance of the parent object.

    Also you may find the ItemSend event of the Application class helpful. It is fired whenever an Microsoft Outlook item is sent, either by the user through an Inspector (before the inspector is closed, but after the user clicks the Sendbutton) or when the Send method for an Outlook item, such as MailItem, is used in a program.

    Tuesday, June 9, 2015 7:48 AM