E-Mail senden

Benötigte Imports

Imports System.Net.Mail


Private Sub Mail_senden()      
    Dim Msg As New MailMessage
    Dim myCredentials As New System.Net.NetworkCredential
    myCredentials.UserName = "E-MAIL-ADRESSE"
    myCredentials.Password = "E-MAIL-PASSWORT"

    Msg.IsBodyHtml = False

    Dim mySmtpsvr As New SmtpClient()
    mySmtpsvr.EnableSsl = True
    mySmtpsvr.Host = "HOST (ZUM BEISPIEL 'gmail.com')"
    mySmtpsvr.Port = 25

    mySmtpsvr.UseDefaultCredentials = False
    mySmtpsvr.Credentials = myCredentials

        Msg.From = New MailAddress("SENDER-E-MAIL")
        Msg.Subject = "BETREFF"
        Msg.Body = "NACHRICHT"
        MsgBox("E-Mail gesendet.", MsgBoxStyle.Information, Title:="Information")
    Catch ex As Exception
        MsgBox(Err.Number & ex.Message & ex.StackTrace.ToString)
    End Try
End Sub

Kommentar verfassen

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.