jump to navigation

programming

Code snippets, tech talk, own software downloads & more…
Please check back regularly.
 

Sending Email with VB.NET and .NET 2.0
Sending Email with VB.NET is very easy. Just follow the steps below:
1.) Declare mail_body as string, containing the email body.
2.) Set references to the following .NET global assemblies.
3.) Compose and send your email by using the SmtpClient Class

 Dim mail_body As String
        mail_body = “your email message here.”

        Try

            Dim message As New MailMessage(”originator@email.com“, “recipent@email.com”, “Your Email subject”, mail_body)
            Dim emailClient As New SmtpClient(”your.email.server”)
            Dim SMTPUserInfo As New System.Net.NetworkCredential(”smtp_username“, “smtp_password”)
            emailClient.UseDefaultCredentials = False
            emailClient.Credentials = SMTPUserInfo
            emailClient.Send(message)
        Catch ex As Exception

            MessageBox.Show(”Error: ” & ex.Message)
            Exit Sub
           

        End Try
 

Comments»

1. Dikmen - April 30, 2007

Hey, DANKE!

Super Sache das Ding funktioniert 1a. Hätte ich nicht gedacht. Hatte diverse Programme ausprobiert, es klappte jedoch nicht ohne weiteres. Weiter so! Wenn du neue Sachen hast, sag bescheid.
Dikmen

2. Mehmet Dikmen - May 12, 2007

andere Programme funkten nicht ohne weiteres!!!! wollte noch mal klar stellen, da ich etwas ungünstig geschrieben habe!
Sorry und Danke

Dikmen

3. volkan6565 - September 24, 2007

hi