How do I send an email using Outlook Express

Posted on 2004-11-06
Last Modified: 2010-04-23
I am relatively new to VB.NET programming, so the answer to my question may require some detail code.
I want to send an email to many recipients whose addresses are in a list box.
I wish to supply the subject and body of the email from text fields.
If I need to import files I need to know which ones.
I am using the first release of Visual Studio.Net Enterprise Edition.
I have searched this data base with poor results.
Question by:Harold_Lominac
    LVL 28

    Accepted Solution

       Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Me.send_via_0("test subject", "", "Hi Iouri", "Outlook")
        End Sub
     Private Sub send_via_0(ByVal subject As String, ByVal toe As String, ByVal body As String, ByVal from As String)
            Dim Appl As Object
            Dim out As Object
                Appl = CreateObject("Outlook.Application")
                out = Appl.CreateItem(0)
                With out
                    .Subject = subject
                    .To = toe
                    .Body = body
                    'to use html in the email instead of plain text
                    'use .HTMLBody instead of .body
                End With
            Catch ex As Exception
                MsgBox("Error " & Err.Number & ": " & ex.Message, MsgBoxStyle.Critical, "Error")
            End Try
        End Sub


    Author Comment

    Thanks for your quick reply.  It seems straight forward, but I haven't tried it yet.  
    You show "from" as "Outlook"  Would it be "Outlook Express" for Outlook Express?
    Also I learned my client uses AOL.  How would I write code for that, set from to AOL?

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now