Click here to Skip to main content
15,671,383 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am converting an old Silverlight application into Asp.Net Core, using Blazor and Razor Pages.

The old application is opening Outlook, and creating an email ready to send with a Subject, From etc, plus a series of attachments.  It is creating an object to do this using the following code:

Dynamic outlook = AutomationFactory.GetObject("Outlook.Application").

The old COM based approach is not supported in ASP.Net core web-sites, however I haven’t been able to find any alternatives.  Any suggestions as to how I can do this in an ASP.Net Core Blazor web-site would be greatly appreciated.  Note that I cannot use a simple MailTo: (as I need to add attachments), and don’t actually want to send the email – I just want it created and loaded in Outlook, ready for the user to manually review\edit and send.

What I have tried:

I have tried COM interops.....
Updated 30-Mar-22 1:19am
Richard MacCutchan 30-Mar-22 6:26am    
Microsoft recommend that you do not try to use Office applications in Websites, as they are often not available on the server.
Dave Kreskowiak 30-Mar-22 9:23am    
You can't interact with Outlook on the client machine. Doing so is a security risk and is, therefor, prohibited.

You could use a mailto link, but even that has problems as browsers impose a limit on the number of characters allowed in the link, usually around 2,000 characters depending on the browser.

1 solution

Why can't you simply present a TextArea that allows the user to review/edit, along with a Send button that does the mechanical stuff (using mailto).

BTW, you can add attachments with mailto - How to use mailto: links to send attachments? : INTERACT Technology[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900