Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.Net: open outlook with to,cc,subject, body , attachment

i want to open the outlook from my vb.net application. I want to fill out the To,Subject, Body and Attachment part of mail through my application. here i don't need to send mail . I want to just open the outlook with mail parameter.

Please suggest how can i achieve this task

like image 549
Rupesh Avatar asked Dec 22 '22 17:12

Rupesh


1 Answers

The general procedure is as follows:

  • Create a mailto: link string with the required information
  • Pass that string to Process.Start. This will open the default mail client, not necessary Outlook.

For example, the string might look like this: mailto:[email protected]?subject=Hello&body=test. The individual fields have to be properly escaped (URL encoded). More information about the syntax can be found in RFC 2368.

An attachment can be added by using the attachment argument in the mailto string. According to a comment on MSDN this has to be doubly quoted, though. That is:

mailto:[email protected]?subject=Hello&body=Test&attachment=""C:\file.txt""
like image 71
Konrad Rudolph Avatar answered Jan 07 '23 22:01

Konrad Rudolph