none
How to check default Email Client set or not

    Question

  • Hello all,

    I am developing WPF application. I need to open default mail client in compose mode with filled basic details like to,bcc,cc,body and attachment.

    Code works good when default mail client is selected.But When i remove default mail client(from default programs in control panel) the code gives.

               MAPI mapi = new MAPI();   /// Mapi default class to add property in email
                mapi.AddAttachment("C:\\TempDocUpload\\adFile.HTML");
                mapi.AddRecipientTo("person1@somewhere.com");
                mapi.AddRecipientTo("person2@somewhere.com");
                mapi.SendMailPopup("testing", "body text");

    I tried to google and found that "Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail", "", "none")" gives  default mail client name. I always get "NONE" as result in all case  whether default mail client set or not.

    I am using "MAPISendMail" method from "MAPI32.DLL" for execution

    PC Configration

    OS : Windows 10 (64 Bit)

    Thanks in Advance.

    Harsh



    Friday, April 21, 2017 1:54 PM

All replies

  • Hi,

    I use code you provide, it works fine for me, I can get the name of default client of email.

    Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail", "", "none")

    so do you have set thedefault Email Client?

    I suggest you check the default value below HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail in register entry.

    Best Regards,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 24, 2017 11:38 AM
    Moderator
  • I am on Win 10 64bit and I get none as the default email client as well when querying the registry key.

    Lloyd Sheen

    Tuesday, April 25, 2017 2:53 PM