When trying to use to code below, I recieve a 500 error. The error occurs on the objMail.Send line.
Any ideas?
intIndex = instr(txtEMail,"@"
if intIndex then
if instr(intIndex + 1,txtEMail,"." then
strMsg = "Dear " & txtFName & " " & txtLName & "," & vbcrlf
strMsg = strMsg + "Your lead has been submitted to RHGS."
strMsg = strMsg + " If you have requested to be contacted, someone will be in touch with you shortly."
strMsg = strMsg + " Please look over the following list for errors. If you did make an error, please resubmit the request form and type update in the comments field."
strMsg = strMsg + vbcrlf & vbcrlf + "Submission Results:" & vbcrlf & vbcrlf
strMsg = strMsg + "First Name:" & " " & txtFName & vbcrlf
strMsg = strMsg + "Last Name:" & " " & txtLName & vbcrlf
strMsg = strMsg + "Company:" & " " & txtCName & vbcrlf
strMsg = strMsg + "Email Address:" & " " & txtEmail & vbcrlf & vbcrlf
strMsg = strMsg + "Phone:" & " " & txtPhone & vbcrlf & vbcrlf
strMsg = strMsg + "Fax:" & " " & txtFax & vbcrlf & vbcrlf
strMsg = strMsg + "Address:" & " " & txtAddress & vbcrlf & vbcrlf
strMsg = strMsg + "City:" & " " & txtCity & vbcrlf & vbcrlf
strMsg = strMsg + "Zip Code:" & " " & txtZipCode & vbcrlf & vbcrlf
strMsg = strMsg + "Comments:" & " " & txtComments & vbcrlf & vbcrlf
strMsg = strMsg + "Submitter Name:" & " " & txtSName & vbcrlf & vbcrlf
strMsg = strMsg + "Submitter Location:" & " " & txtSLocation & vbcrlf & vbcrlf
strMsg = strMsg + "Submitter Phone:" & " " & txtSPhone & vbcrlf & vbcrlf
' strMsg = strMsg + "Contact Requested:" & " " & txtContact & vbcrlf & vbcrlf
end if
strMsg = strMsg & vbcrlf & vbcrlf
strMsg = strMsg & "Sincerely," & vbcrlf
strMsg = strMsg & "Rural Health Group Services" & vbcrlf
set objMail = CreateObject("CDONTS.Newmail"
objMail.From = "address@domain.com"
objMail.To = txtEMail
objMail.Subject = "RHGS Lead from the Web"
objMail.Body = strMsg
objMail.Send
set objMail = nothing
set strMsg = nothing
end if
Any ideas?
intIndex = instr(txtEMail,"@"
if intIndex then
if instr(intIndex + 1,txtEMail,"." then
strMsg = "Dear " & txtFName & " " & txtLName & "," & vbcrlf
strMsg = strMsg + "Your lead has been submitted to RHGS."
strMsg = strMsg + " If you have requested to be contacted, someone will be in touch with you shortly."
strMsg = strMsg + " Please look over the following list for errors. If you did make an error, please resubmit the request form and type update in the comments field."
strMsg = strMsg + vbcrlf & vbcrlf + "Submission Results:" & vbcrlf & vbcrlf
strMsg = strMsg + "First Name:" & " " & txtFName & vbcrlf
strMsg = strMsg + "Last Name:" & " " & txtLName & vbcrlf
strMsg = strMsg + "Company:" & " " & txtCName & vbcrlf
strMsg = strMsg + "Email Address:" & " " & txtEmail & vbcrlf & vbcrlf
strMsg = strMsg + "Phone:" & " " & txtPhone & vbcrlf & vbcrlf
strMsg = strMsg + "Fax:" & " " & txtFax & vbcrlf & vbcrlf
strMsg = strMsg + "Address:" & " " & txtAddress & vbcrlf & vbcrlf
strMsg = strMsg + "City:" & " " & txtCity & vbcrlf & vbcrlf
strMsg = strMsg + "Zip Code:" & " " & txtZipCode & vbcrlf & vbcrlf
strMsg = strMsg + "Comments:" & " " & txtComments & vbcrlf & vbcrlf
strMsg = strMsg + "Submitter Name:" & " " & txtSName & vbcrlf & vbcrlf
strMsg = strMsg + "Submitter Location:" & " " & txtSLocation & vbcrlf & vbcrlf
strMsg = strMsg + "Submitter Phone:" & " " & txtSPhone & vbcrlf & vbcrlf
' strMsg = strMsg + "Contact Requested:" & " " & txtContact & vbcrlf & vbcrlf
end if
strMsg = strMsg & vbcrlf & vbcrlf
strMsg = strMsg & "Sincerely," & vbcrlf
strMsg = strMsg & "Rural Health Group Services" & vbcrlf
set objMail = CreateObject("CDONTS.Newmail"
objMail.From = "address@domain.com"
objMail.To = txtEMail
objMail.Subject = "RHGS Lead from the Web"
objMail.Body = strMsg
objMail.Send
set objMail = nothing
set strMsg = nothing
end if