Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim msg As New MailMessage
msg.From = New MailAddress(txtFrom.Text)
msg.To.Add(txtTo.Text)
msg.CC.Add(txtCC.Text)
msg.Bcc.Add(txtBCC.Text)
msg.Priority = CType([Enum].Parse(GetType(MailPriority), cboPriority.Text), MailPriority)
msg.Subject = txtSubject.Text
msg.Body = txtBody.Text
'msg.
'If txtAttachment.Text.Length > 0 Then
' Dim attachment As New MailAttachment(txtAttachment.Text)
' msg.Attachments.Add(attachment)
'End If
Try
Dim smtp As SmtpClient = New SmtpClient("smtp.att.yahoo.com")
smtp.EnableSsl = True
'Enter the Authentication Credentials
Dim cred As New System.Net.NetworkCredential("********@sbcglobal.net", "********")
smtp.Credentials = cred
smtp.Port = 465
smtp.Send(msg)
Catch ex As HttpException
MsgBox(ex.Message)
End Try
End Sub
|