I am using CDONTS to send e-mail. However, this script sometimes gets out of control and sends the same e-mail out thousands of times per second. To stop sending, i have to stop SMTP and reinstall it. Does anyone know what this problem might be, or how to fix it?
<%
Dim strTo
Dim strSubject
Dim strBody
Dim strResponse
Dim objCDOMail
strTo = Request.Form("to"
strSubject = Request.Form("subject"
strBody = Request.Form("body"
strResponse = "Message has been sent!"
strBody = strBody & vbCrLf & vbCrLf
strBody = strBody & vbCrLf
If strTo = "" Or Not IsValidEmail(strTo) Then
%>
<FORM ACTION="./email.asp" METHOD="post">
Select Department:<BR>
<select name="to">
<option value="dan@teleplanetcommunications.com">Administration</option>
<option value="andrew@teleplanetcommunications.com">Technical</option>
</select>
<br>
Subject:
<br>
<INPUT TYPE="text" NAME="subject" SIZE="30"></INPUT><BR>
Message:
<br>
<TEXTAREA NAME="body" ROWS="10" COLS="40" WRAP="virtual"></TEXTAREA><BR>
<INPUT TYPE="submit" VALUE="Send Message!"></INPUT>
</FORM>
<%
Else
Set objCDOMail = Server.CreateObject("CDONTS.NewMail"
objCDOMail.From = "Visitor <Server@tplanet.com>"
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
objCDOMail.Cc = "user@domain.com;user@domain.com"
objCDOMail.Send
Set objCDOMail = Nothing
Response.Write strResponse
End If
%>
<%
Function IsValidEmail(strEmail)
Dim bIsValid
bIsValid = True
If Len(strEmail) < 5 Then
bIsValid = False
Else
If Instr(1, strEmail, " " <> 0 Then
bIsValid = False
Else
If InStr(1, strEmail, "@", 1) < 2 Then
bIsValid = False
Else
If InStrRev(strEmail, "." < InStr(1, strEmail, "@", 1) + 2 Then
bIsValid = False
End If
End If
End If
End If
IsValidEmail = bIsValid
End Function
%>
<%
Dim strTo
Dim strSubject
Dim strBody
Dim strResponse
Dim objCDOMail
strTo = Request.Form("to"
strSubject = Request.Form("subject"
strBody = Request.Form("body"
strResponse = "Message has been sent!"
strBody = strBody & vbCrLf & vbCrLf
strBody = strBody & vbCrLf
If strTo = "" Or Not IsValidEmail(strTo) Then
%>
<FORM ACTION="./email.asp" METHOD="post">
Select Department:<BR>
<select name="to">
<option value="dan@teleplanetcommunications.com">Administration</option>
<option value="andrew@teleplanetcommunications.com">Technical</option>
</select>
<br>
Subject:
<br>
<INPUT TYPE="text" NAME="subject" SIZE="30"></INPUT><BR>
Message:
<br>
<TEXTAREA NAME="body" ROWS="10" COLS="40" WRAP="virtual"></TEXTAREA><BR>
<INPUT TYPE="submit" VALUE="Send Message!"></INPUT>
</FORM>
<%
Else
Set objCDOMail = Server.CreateObject("CDONTS.NewMail"
objCDOMail.From = "Visitor <Server@tplanet.com>"
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
objCDOMail.Cc = "user@domain.com;user@domain.com"
objCDOMail.Send
Set objCDOMail = Nothing
Response.Write strResponse
End If
%>
<%
Function IsValidEmail(strEmail)
Dim bIsValid
bIsValid = True
If Len(strEmail) < 5 Then
bIsValid = False
Else
If Instr(1, strEmail, " " <> 0 Then
bIsValid = False
Else
If InStr(1, strEmail, "@", 1) < 2 Then
bIsValid = False
Else
If InStrRev(strEmail, "." < InStr(1, strEmail, "@", 1) + 2 Then
bIsValid = False
End If
End If
End If
End If
IsValidEmail = bIsValid
End Function
%>