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开发者_JS百科 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!
精彩评论