Hi freinds
I want to send an email using VB.NET2005.
Can any one help me in it any :icon_redface:

9 Years
Discussion Span
Last Post by emurf

Try using Microsoft's CDO control. Finding it may be a head ache since there are a bunch of different versions. I think that I was using 6.5 when I wrote this;

Private Sub SendMail(ByVal sEmail As String)
        'this procedure recieves an email address and sends a message.
        'Dim objCDO As New CDO.Message
        Dim objSendMail As New CDO.Message
        Dim strEmailAddress As String

            strEmailAddress = sEmail
            With objSendMail
                .From = "emailaddress@somewhere.com"
                .To = RTrim(strEmailAddress)
                '.CC = "ccemail@somewhere.com"
                .Subject = "Your Subject Here"
                .TextBody = "Put your message here"
                .HTMLBody = "<H3>For HTML Messages</H3>" & _
                            "<P>Format in HTML just put everything between quotes</P>"
            End With
        Catch ex As Exception
            'do your error handling here
            objSendMail = Nothing
        End Try

End Sub

CDO.dll came with Outlook Pro prior to the 2007 version (I don't know if it ships with 2007). If you don't have it you should be able to find it by searching http://msdn.microsoft.com.

Another way is to add a MAPI control to your project. I've only did this in one project but I hear that it is best with VB .NET 2005. This is what I wrote.

Private Sub sendMail(ByVal FName As String, ByVal lName As String, ByVal eMail As String)
        'sends the email
            'Open up a MAPI session

            'Point the MAPI messages control to the open MAPI session
            Me.mapiMessage.SessionID = Me.mapiSession.SessionID

            'Start a new message

            With Me.mapiMessage
                .MsgSubject = "Your Subject"
                .MsgReceiptRequested = True
                .MsgNoteText = "This is the message."
                .RecipType = 1
                .RecipAddress = eMail
                .Action = 13
            End With

            'sign off of the session

            'increase the mail count
            Me.mintSent += 1

        Catch ex As Exception
        End Try
    End Sub

recently i was faced a problem to update, insert and delete the data from the table by using vb.net code, can u help me to solve the problem.


Teopohkuang; I can help but can you create a new thread with your question, include as much detail about your problem as you can describe, so that others with similar problems can more easily find it?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.