Vb net send mail

In VB.NET, you can send an email using the System.Net.Mail namespace. Here's a simple example:

Imports System.Net.Mail

Module SendEmail
    Sub Main()
        Dim fromAddress As New MailAddress("[email protected]")
        Dim toAddress As New MailAddress("[email protected]")
        Dim subject As String = "Test Email"
        Dim body As String = "This is a test email sent using VB.NET"

        Dim mail As New MailMessage(fromAddress.Address, toAddress.Address)
        mail.Subject = subject
        mail.Body = body

        Dim smtp As New SmtpClient()
        smtp.Host = "smtp.example.com"
        smtp.Port = 587
        smtp.Credentials = New NetworkCredential("username", "password")
        smtp.EnableSsl = True

        Try
            smtp.Send(mail)
            Console.WriteLine("Email sent successfully")
        Catch ex As Exception
            Console.WriteLine("Error sending email: " & ex.Message)
        End Try
    End Sub
End Module

In this example, we create a new MailMessage object and set its properties (from address, to address, subject, and body). We then create a new SmtpClient object and set its properties (host, port, credentials, and enable SSL). Finally, we use the Send method to send the email.

You'll need to replace the placeholders ([email protected], [email protected], smtp.example.com, username, and password) with your actual email settings.

Note that this is a basic example, and you may want to add more features such as attachments, HTML formatting, or error handling.