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 ("") = 25
		.Item(cdoSendUsername) = "xxx"
		.Item(cdoSendPassword) = "xxx"
	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
		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
			End With
		End If
	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
	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

Bob SchneiderCo-OwnerAsked:
Who is Participating?
MlandaTConnect With a Mentor Commented:
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?
Bob SchneiderCo-OwnerAuthor 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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.