none
C# code to get outlook outgoing mail server name of a particular user account. RRS feed

  • Question

  • Hii,

    I am creating addin for outlook for which in one of my tasks I need to get the outlook configured outgoing mail server(smtp) name of a particular configured account in outlook.I am unable to get a solution for this problem.

    Outlook.Accounts accounts = application.Session.Accounts;
    foreach (Outlook.Account account in accounts)
    {
    // I want to show the account outgoing mail server address
    }

    Anyone please help with this.

    Thanks in advance.

    T.Sudhir 


    Monday, April 4, 2016 12:38 PM

Answers

  • Hi sudhir, 

    There is no such API we are able to get the SMTP server using the Outlook object model. If you want the Outlook object model to support this feature, you can try to submit the feedback from link below:
    https://outlook.uservoice.com/

    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.

    Thursday, April 7, 2016 10:49 AM
    Moderator

All replies

  • Hello Sudhir,

    You may find the following properties of the Account class helpful:

    1. UserName - returns a String representing the user name for the Account.

    2. DisplayName - returns a String representing the display name of the e-mail Account.

    3. SmtpAddress - returns a String representing the Simple Mail Transfer Protocol (SMTP) address for the Account. 

    The purpose of SmtpAddress and Account.UserName is to provide an account-based context to determine identity. If the account does not have an SMTP address, SmtpAddress returns an empty string.

    Also you may find the SendUsingAccount property of the MailItem class which returns an Account object that represents the account under which the MailItem is to be sent. 

    Monday, April 4, 2016 5:13 PM
  • Hii Eugene,

    Thanks for the reply bro, but actually I need to know the outgoing smtp server name (e.g smtp.smtpmailserver.com) that the outlook is using.

    account SmtpAddress will give me the email address with which my account has been configured.

    Thanks

    Tuesday, April 5, 2016 11:40 AM
  • Hi sudhir, 

    There is no such API we are able to get the SMTP server using the Outlook object model. If you want the Outlook object model to support this feature, you can try to submit the feedback from link below:
    https://outlook.uservoice.com/

    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.

    Thursday, April 7, 2016 10:49 AM
    Moderator