Imports System.Net.Mail Imports System.Net Public Class Form1 Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim mFrom, mTo As String mFrom = "hostemailaddress@yahoo.co.uk" mTo = "targetemailaddress@yahoo.com" Dim mPort As Int32 mPort = 25 'default port for mail server Dim email As New MailMessage(mFrom, mTo) email.Subject = "Test Subject" email.Body = Hello World Dim mySmtpClient As New SmtpClient("yahoo.co.uk", mPort) mySmtpClient.UseDefaultCredentials = True Dim emailAdr As String Dim passwrd As String emailAdr = "hostemailaddress@yahoo.co.uk" passwrd = "password" mySmtpClient.Credentials = New NetworkCredential(emailAdr, passwrd) mySmtpClient.Send(email) End Sub End Class
Dim mySmtpClient As New SmtpClient("smtp.yahoo.co.uk", mPort)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)