From: Paul Steinberg on
Private Sub btnSendEmail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendEmail.Click
Try
Dim Email As New System.Net.Mail.MailMessage(Me.EmailFrom.Text, Me.EmailTo.Text, Me.EmailSubject.Text, Me.EmailBody.Text)
If Me.txtBoxCC.Text > "" Then
Email.CC.Add(Me.txtBoxCC.Text)
End If

Dim mailClient As New System.Net.Mail.SmtpClient()
'This object stores the authentication values


Email.Attachments.Add(New System.Net.Mail.Attachment(FileName))

Dim basicAuthenticationInfo As New System.Net.NetworkCredential("mailto:send(a)smallbsystems.com", "password")
'Put your own, or your ISPs, mail server name onthis next line

mailClient.Host = "smtp.1and1.com"
mailClient.Port = 587
mailClient.UseDefaultCredentials = True
mailClient.Credentials = basicAuthenticationInfo


mailClient.Send(Email)
Catch ex As System.Net.Sockets.SocketException
MsgBox(ex.ToString)
Catch ex As System.Net.Mail.SmtpException
MsgBox(ex.ToString)
Catch ex As FormatException
MsgBox(ex.ToString)
Return
Catch ex As Global.System.Exception
MsgBox(ex.ToString)
Return
End Try

MsgBox("Email has been sent to " & Me.EmailTo.Text)
Me.Close()
End Sub.
Submitted using http://www.outlookforums.com