skip to Main Content

i’m developping an ASP.NET Core project with Angular as front-End.
after a user creates an invoice, i want to open outlook in mode ‘New mail’ with the customer adrees mail prefilled and the invoice document attached.

there is no problem in sending the cistomer mail or creating the invoice document (PDF).
the roblem is how to open outlook in the user pc and attach the document to a mail ready to be sent.

Thanks a lot.

2

Answers


  1. The best what you could do is to use the mailto protocol from your web application for opening the default mail client.

    The Considerations for server-side Automation of Office article states the following:

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

    Login or Signup to reply.
  2. Besides a mailto link, your other option is creating an EML (MIME file) with the subject/body/attachment pre-populated. The desktop version of Outlook will be happy to open an EML file, and if the message includes X-Unset: 1 MIME header, the mesage will be show in the draft (unsent) mode ready to be sent.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search