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

Recommended Answers

All 4 Replies

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

        Try
            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>"
                .Send()
            End With
        Catch ex As Exception
            'do your error handling here
        Finally
            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
        Try
            'Open up a MAPI session
            Me.mapiSession.SignOn()

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

            'Start a new message
            Me.mapiMessage.Compose()

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

            'sign off of the session
            Me.mapiSession.SignOff()

            'increase the mail count
            Me.mintSent += 1

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.