[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

SMS Messaging Reliability Issue

I have an sms system in my web site that allows my users to text each other.  It has similar issues to my email system (I am not intending to double-post...I know these ideas are related but I was thinking they would be different enough to justify separate posts).  There are more 500 errors than I would like to see.  Here is my code...any feedback would be much appreciated.

	Set cdoConfig = CreateObject("CDO.Configuration")
	With cdoConfig.Fields
		.Item(cdoSendUsingMethod) = cdoSendUsingPort
		.Item(cdoSMTPServer) = "xxx"
		.Item(cdoSMTPAuthenticate) = 1
		.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
		.Item(cdoSendUsername) = "xxx"
		.Item(cdoSendPassword) = "xxx"
		.Update
	End With
	
	Set cdoMessage = Server.CreateObject("CDO.Message")
	Set cdoMessage.Configuration = cdoConfig

	'first send to head coach
	If Not CStr(lCoachProvider) & "" = "" Then
		With cdoMessage
			.From = sMyNumber & GetSendURL(lMyProvider)
			.To = sCoachNumber & GetSendURL(lCoachProvider)
			.TextBody = sMsg
			.Send
		End With
	End If
	
	'now send to designated recipients
	For i = 0 To UBound(Recips, 2) - 1
		If Not CStr(Recips(1, i)) & "" = "" Then
			With cdoMessage
				.From = sMyNumber & GetSendURL(lMyProvider)
				.To = Recips(2, i) & GetSendURL(Recips(1, i))
				.TextBody = sMsg
				.Send
			End With
		End If
	Next
		
	Set cdoMessage = Nothing
End If
	 			
Private Sub GetRecip(lMyID, sMyRole, sMyLevel)
	'currently only being used for the participants gotten from the roster groups...could also be used to get staff, contacts and assts as we did on the 
	'txt_msg page we will see which approach works better
	bIsRecip = False
	lThisProvider = 0
	sThisNumber = vbNullString
	
	Set rs2 = Server.CreateObject("ADODB.Recordset")
	sql2 = "SELECT Provider, Number FROM MyWireless WHERE MyID = " & lMyID & " AND MyRole = 'Participant'"
	rs2.Open sql2, conn, 1, 2
	If rs2.RecordCount > 0 Then
		If Not rs2(0).Value & "" = "" Then
			If Not rs2(1).Value & "" = "" Then 
				lThisProvider = rs2(0).Value
				sThisNumber = rs2(1).Value
				bIsRecip = True
			End If
		End If
	End If
	rs2.Close
	Set rs2 = Nothing
End Sub

Private Function GetSendURL(lProviderID)
	If Not CStr(lProviderID) & "" = ""  Then
		Set rs = Server.CreateObject("ADODB.Recordset")
		sql = "SELECT SendURL FROM WrlsPrvdr WHERE WrlsPrvdrID = " & lProviderID
		rs.Open sql, conn, 1, 2
		If rs.RecordCount > 0 Then GetSendURL = rs(0).Value
		Set rs = Nothing
	End If
End Function

Open in new window

0
Bob Schneider
Asked:
Bob Schneider
1 Solution
 
MlandaTCommented:
Have you checked the web server logs for more details on the HTTP 500 errors? How many concurrent users do you have on this site at the time you start getting HTTP 500 errors?
0
 
Bob SchneiderAuthor Commented:
I get pretty accurate error reporting but it seems like I have cleaned up the code on those and I still get errors...mostly "no recipient found" issues.  Just wondering if there is something in my code that could be changed to:
1) better accommodate user errors, and
2) keep the thing from completely crashing in the middle of a send if a single error appears.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now