Private Sub SendHtmlFormattedEmail(ByVal recepientEmail As String, ByVal subject As String, ByVal body As String)
Dim mailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage
Try
mailMessage.From = New MailAddress(ConfigurationManager.AppSettings("UserName"))
' mailMessage.CC.Add("[email protected]")
mailMessage.Bcc.Add("[email protected]")
mailMessage.Subject = subject
mailMessage.Body = body
mailMessage.IsBodyHtml = True
mailMessage.To.Add(New MailAddress(recepientEmail))
Dim files As List(Of HttpPostedFile) = DirectCast(Cache(Me.Key), List(Of HttpPostedFile))
For Each file As HttpPostedFile In files
mailMessage.Attachments.Add(New Attachment(file.InputStream, Path.GetFileName(file.FileName), file.ContentType))
Next
mailMessage.From = New MailAddress("[email protected]")
Dim smtp As New SmtpClient()
smtp.Host = "202.165.228.15"
smtp.EnableSsl = False
smtp.Credentials = New System.Net.NetworkCredential("[email protected]", "Pakistan_123")
smtp.Port = 25
smtp.Send(mailMessage)
Catch ex As Exception
ex.Message.ToString()
End Try
End Sub