TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tuman Sahu
1.3k
291
8.6k
SMS & Email does not work in IIS but running in Local Server
Dec 11 2019 12:44 AM
I am making a project for safety. Here i want to sent SMS and Email to end user my SMS and Email function code is bellow. This code is running is Local Server very smoothly and don't know why its not fuctioning in IIS .
Can any one help me what is the actual problem ?
Dim ForSendMessage As String = " ID : " & uc.ID.ToString() & " Is Assign For Unsafe Act/Condition :" & Session("UnsafeMsg").ToString()
Dim strUrl As String = "Using One SMS API Code"
Dim request As WebRequest = HttpWebRequest.Create(strUrl)
Dim response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse)
Dim s As Stream = DirectCast(response.GetResponseStream(), Stream)
Dim readStream As New StreamReader(s)
Dim dataString As String = readStream.ReadToEnd()
lblAssigntoMobile.Text = dataString.ToString
response.Close()
s.Close()
readStream.Close()
Dim st As String = lblAssigntoMobile.Text
Dim subst As String = st.Substring(17, 4)
If subst <> "3001" Then
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "alert", "alert('" & subst.ToString & "')", True)
Else
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "alert", "alert('Message Sent')", True)
End If
Dim mail As MailMessage = New MailMessage()
Const username As String = "myemailid"
Const password As String = "myemailpassword"
Dim smtpclient As SmtpClient = New SmtpClient()
Dim fromaddress As MailAddress = New MailAddress("myemailid")
smtpclient.Host = "smtp.gmail.com"
smtpclient.Port = 587
mail.From = fromaddress
mail.[To].Add(lblAssigntoEmailId.Text)
mail.Subject = ("Hi Test Mail")
mail.IsBodyHtml = True
mail.Body = "<html><head><title>" & HttpUtility.HtmlEncode("Safety Mail") & "</title></head><body style='height:600px'>" & "<p>" + HttpUtility.HtmlEncode(Session("UnsafeMsg").ToString()) & "</p>" & "</body></html>"
smtpclient.EnableSsl = True
smtpclient.DeliveryMethod = SmtpDeliveryMethod.Network
smtpclient.Credentials = New System.Net.NetworkCredential(username, password)
smtpclient.Send(mail)
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "alert", "alert('Mail has been sent!!,ID:" & uc.ID & "')", True)
Reply
Answers (
4
)
Create Scroll Bar
best design for an responsibility system