Using OutLook with VB.NET

Started by
12 comments, last by MetroidHunter 20 years, 10 months ago
I''m trying to add a feature to my application so that when the user clicks a button, it allows them to type an email up in a seperate form, and then send it using Outlook, passing in values from textboxes. So far, I''ve been able to get it to send the email address to outlook using the commands:

Dim link As String = "mailto://" & emailDir.GetCurrentRow("strEmail")

Try
            Process.Start("OutLook.exe", link)
...
Is there any way to accomplish this?
Advertisement
Try Process.Start''ing a mailto: link instead.


AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
I already caught mistake that after I posted. I just can''t find any information on how to fill the subject and message fields in outlook.
What about of using the outlook object model to start outlook and get some REAL control over it?
RegardsThomas TomiczekTHONA Consulting Ltd.(Microsoft MVP C#/.NET)
How would I go about doing that?
Nevermind, I think I got it.
Right now, I have a rich textbox where the body of the email is entered, and I have added checkboxes to make the text bold, italicized, and/or underlined, which work correctly when I type the email body in the form. When I go to send the email, the formatting I do is lost and the result is just plain text. I can't determine whether or not this is a coding problem, or if it's something I need to set on outlook. My code for sending the email is:
Dim oLapp As Object        Dim oItem As Object        Try            oLapp = CreateObject("Outlook.application")            oItem = oLapp.CreateItem(0)            With oItem                .Subject = txtSubject.Text                .To = txtSendTo.Text                .Body = rtbMessage.Text                .Send()            End With            MsgBox("Email sent!", MsgBoxStyle.Information, emailDir.GetAppName)        Catch f As Exception            MsgBox("Email could not be sent." & CrLf & "Make sure Outlook is configured properly.", MsgBoxStyle.Information, emailDir.GetAppName)        Finally            oLapp = Nothing            oItem = Nothing            Me.Close()        End Try



[edited by - MetroidHunter on June 19, 2003 1:31:17 PM]
Outlook(and any other decent mail client) is usually set to wrap text at ~76 characters.


AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
yeah, but why isn''t it letting my send rich text through my program. It will let me do it from Outlook, so why not from my program? >_<
anyone able to help? >_<

This topic is closed to new replies.

Advertisement