How to open Outlook New Mailbox window from VB.NET

I have a scenario in which the user can make a choice from the grid (with the downloaded files in the local folder), and when the user clicks “send”, the application should open the “New mail message” window in Outlook, in which there are selected files as attachments ( which is selected by the user from the grid).

Any help would be appreciated.

+3
source share
3 answers

If you want to receive an Outlook message and you need more options for sending (body text, attachments, BCC, etc.):

Dim Outl As Object
Outl = CreateObject("Outlook.Application")
If Outl IsNot Nothing Then
    Dim omsg As Object
    omsg = Outl.CreateItem(0) '=Outlook.OlItemType.olMailItem'
    'set message properties here...'
    omsg.Display(True) 'will display message to user
End If
+6
source
Imports System.Diagnostics

Process.Start(String.Format("mailto:{0}", address))

' set all possible parameters: '

Process.Start(String.Format("mailto:{0}?subject={1}&cc={2}&bcc={3}&body={4}", address, subject, cc, bcc, body))

' also escape spaces: '

Process.Start(String.Format("mailto:{0}?subject=\"{1}\"&cc={2}&bcc={3}&body=\"{4}\"", address, subject, cc, bcc, body))

:

body = body.Replace(Environment.NewLine ,"%0A")

.

Outlook , .


( , ..), .

+11
Dim Outl As Object
Outl = CreateObject("Outlook.Application")
If Outl IsNot Nothing Then
    Dim omsg As Object
    omsg = Outl.CreateItem(0)
    omsg.To = "yusuf@hotmail.com"
    omsg.bcc = "yusuf@gmail.com"
    omsg.subject = "Hello"
    omsg.body = "godmorning"
    omsg.Attachments.Add("c:\HP\opcserver.txt")
    'set message properties here...'
    omsg.Display(True) 'will display message to user
+4
source

Source: https://habr.com/ru/post/1782257/


All Articles