简体   繁体   中英

Sending email in .Net

I have a web application deployed in a server. On a button click, I need to open outlook new mail window with some values populated in a particular format.

So that the user can edit the values if want and change the To, CCC fields with the recipient list, and then send the mail manually.

Note: Assumption is that there is outlook client installed in the client machine

SMTP will not work as it doesn't open outlook window; it just sends the mail with all the customizations you want in background, there won't be any UI where user can edit the values.

mailto may solve the problem, but it has a limit of around 450 characters of body and we have around 2 pages of body.

Interop , there is a interop assembly which provides the similar functionality, but this requires outlook to be installed on the server where the application is deployed.

You can use the MAPISendMail api from MAPI. I used this in the past in some projects.

You can pass the function the MAPI_DIALOG flag to tell it to open a dialog for the user.

See for example: http://sundararajana.blogspot.de/2007/09/mapisendmail-in-c-application.html http://www.codeproject.com/Articles/2048/Simple-MAPI-NET

An alternative might be the Office Interop APIs, but I think they will be more complicated to work with. Also MAPI should work with other email clients thatn outlook as well (in theory at least).

Hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM