Public Sub Sendtxtmsg(ByVal cellnumber As String, ByVal objMailTo As String, ByVal content As String)
Dim stringWriterTmp As New StringWriter()
Dim htmlWriter As New HtmlTextWriter(stringWriterTmp)
' Dim htmlContent As String
Dim strContents As String = content
' grvBasketDetail.RenderControl(htmlWriter)
' htmlContent = stringWriterTmp.ToString()
Dim email As String = cellnumber & "@" & objMailTo
Dim message As New MailMessage()
message.From = New MailAddress(ConfigurationManager.AppSettings("MAIL_FROM").ToString(), "name of sender")
If (objMailTo <> "") Then
message.To.Add(New MailAddress(email))
End If
message.Subject = ConfigurationManager.AppSettings("TEXT_MESSAGES_SUBJECT").ToString()
message.Priority = MailPriority.High
message.Body = strContents
message.IsBodyHtml = True
Dim emailClient As New SmtpClient(ConfigurationManager.AppSettings("SmtpServer").ToString())
Dim SMTPUserInfo As New System.Net.NetworkCredential(ConfigurationManager.AppSettings("username").ToString(), ConfigurationManager.AppSettings("Password").ToString())
emailClient.UseDefaultCredentials = False
emailClient.Credentials = SMTPUserInfo
emailClient.Send(message)
End Sub
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment