none
Default Email App RRS feed

  • Question

  • Hi,

    I've developed a C# Windows Forms application that sends internet emails

    Is it possible to use my app as the Default Email App on Windows 10 for Mailto: links ?

    What I have to do in my code and windows settings ?

    Thank you very much

    Wednesday, April 10, 2019 2:19 PM

All replies

  • Hello,

    There are provisions for sending email messages via mailto: to any email client other than the current default program.

    See the following

    https://weblogs.asp.net/jongalloway/sending-files-via-the-default-e-mail-client


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, April 10, 2019 2:55 PM
    Moderator
  • Thank you but what am i trying to achieve is that  the app i've developed becomes the default windows email to client (a request from one of our customers) ...
    How to modify my C# code to respond to mailto requests and how to configure Windows
    Wednesday, April 10, 2019 3:08 PM
  • Manually you just need to use the Default Apps program in Windows, go to Email and click it and then browse to your app and select it. Windows will then use it as the default main program.

    Programmatically your installer would need to do the same thing by associating your app with the mailto scheme. However you'd want to prompt the user first as taking over their email program automatically would not be nice.


    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, April 10, 2019 6:14 PM
    Moderator
  • Well, wait a minute.  Is your application a complete mail reader, like Outlook?  Or is it just an outgoing mail sender?  There are instructions on the web on how to change the "mailto:" handler to another application:

    https://myalbum.zendesk.com/hc/en-us/articles/206101281-Default-e-mail-program-in-windows-10


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Wednesday, April 10, 2019 8:47 PM
  • The application that i have developed is a complete mail reader like Outlook but is not listed in the Windows 10 default programs list.

    A customer asked my CEO if is it possible to have this application on the list in order to set as windows default and respond to mailto links on web pages.

    I suppose that there are some registry keys to add in order to let my application be listed.

    I suppose that there is some command line like mechanism that is passed to my application after the association is done and when the mailto link is clicked.

    My application is single instance application, another question to solve... if the mail to is passed via command line...

    Thursday, April 11, 2019 7:04 AM
  • If your app isn't a Winstore app then it won't show up as a default app in newer versions of Windows. MS has removed the ability to set a non-Winstore app as a default in the UI. You'll have to do it programmatically or use a third party tool.

    HKCR\mailto is where this is stored I believe. Set the open command to your app and it should use it for mail links. However I have no idea how this will appear to a user in Default Apps.


    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, April 11, 2019 1:53 PM
    Moderator
  • I've tried

    HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\...

    but Windows doesn't list my app

    and

    HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\mailto\UserChoice

    but the association doesn't work for my app...

    i doubt that is possible





    Friday, April 12, 2019 1:38 PM
  • Did you try the key that I mentioned? Note that it won't, most likely, show up in the UI because it isn't a store app but that doesn't mean it isn't working. You can drop a mailto: shortcut on your desktop to test which app it is using.

    I really think this is more of a Windows tech support question since you aren't writing code to do this. I think you would do better to post this question in the TechNet forums for Windows.


    Michael Taylor http://www.michaeltaylorp3.net

    Friday, April 12, 2019 1:47 PM
    Moderator
  • Well,

    i wrote all the mail client code :)

    yes, as you suggested I've tried

    HKEY_CLASSES_ROOT\mailto\shell\open\command

    but in every try i make i see no results.

    thank you anyway.

     <!DOCTYPE HTML>    
    <html>
    <body>
    <a href="mailto:indirizzo@email.com?subject=Oggetto%20del%20messaggio">Scrivimi una mail</a>
    </body>
    </html>   

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\mailto]
    @="Robin URL"
    "EditFlags"=dword:00000002
    "FriendlyTypeName"="Robin URL"
    "URL Protocol"=""

    [HKEY_CLASSES_ROOT\mailto\DefaultIcon]
    @="C:\\Program Files\\Robin7\\Robin.exe,0"

    [HKEY_CLASSES_ROOT\mailto\shell]

    [HKEY_CLASSES_ROOT\mailto\shell\open]

    [HKEY_CLASSES_ROOT\mailto\shell\open\command]
    @="\"C:\\Program Files\\Robin7\\Robin.exe\" -osint -compose \"%1\""

    Friday, April 12, 2019 2:03 PM
  • Yes but you're now trying to hack Windows to get it to recognize your app. This isn't a programming problem to me. It is a Windows issue so I think you'll get better support over in TechNet.

    Michael Taylor http://www.michaeltaylorp3.net

    Friday, April 12, 2019 2:10 PM
    Moderator
  • That looks basically correct.  How are you testing this?

    Tim Roberts | Driver MVP Emeritus | Providenza &amp; Boekelheide, Inc.

    Friday, April 12, 2019 8:47 PM
  • The application that i have developed is a complete mail reader like Outlook but is not listed in the Windows 10 default programs list.

    A customer asked my CEO if is it possible to have this application on the list in order to set as windows default and respond to mailto links on web pages

    What is so special about your program that it is to be used over Win10's Mail program?

    Win10's Mail program  will startup as the default mail program in response to Web Page mailto links, if Win10's Mail program has been configured, which can use a Gmail,  Outlook.com or both mail accounts.

    Friday, April 12, 2019 9:59 PM
  • You cn cha
    Saturday, April 13, 2019 1:53 AM
  • You can change the default application for mailto with the IApplicationAssociationRegistrationInternal interface on Windows 10 (from IApplicationAssociationRegistration, Guid "2a848e25-d688-4aa3-8e55-0c16cb3a2dfb")

    I tested by setting Notepad and it worked, but it is not documented...

    (it updated the ProgId and Hash at 

    HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\mailto\UserChoice)

    Saturday, April 13, 2019 2:00 AM
  • Hi

    Is your problem solved? If so, please post "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Jack


    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.

    Tuesday, May 7, 2019 8:08 AM
    Moderator