Simple .net form to open outlook and populate fields?
Posted on 2012-03-18
I'm trying to make a simple form in vb (using visual studio) where my user can enter an email address, attach document(s), and enter a name, then click submit and it opens the an outlook email to where she can preview the email and then click send...this is my start (below), but it doesn't populate. If I use With and then automate the send, it does fine, but when i remove the send it doesn't populate. What am I missing?
Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Dim Outl As Outlook.Application
Outl = CreateObject("Outlook.Application")
Dim olMail As Outlook.MailItem
olMail = Outl.CreateItem(Outlook.OlItemType.olMailItem)
olMail.To = "email@example.com"
olMail.Subject = "About our meeting..."
olMail.Body = _
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