内部服务器错误发送表格 [英] Internal Server Error to send Form
问题描述
请Helpme,我有这个错误,当我发送的联系方式:
Please Helpme, i have this error, when I send the contact form :
我的Visual Basic code:
My Visual Basic code:
<%
mail_to = "jrclurita@gmail.com"
Dim error
error = 0
For Each f In Request.Form
If Request.Form(f) = "" Then
error = 1
End If
Next
If error=1 Then
response.redirect "error.html"
Else
Dim f, emsg, mail_to, r, o, c, other
fline = "_______________________________________________________________________"& vbNewLine
hline = vbNewLine & "_____________________________________"& vbNewLine
emsg = ""
For Each f In Request.Form
If mid(f,1,1)<>"S" = True Then 'do not save if input name starts with S
emsg = emsg & f & " = " & Trim(Request.Form(f)) & hline
End If
Next
Set objNewMail = Server.CreateObject("CDONTS.NewMail")
objNewMail.From = Request("Email Address")
objNewMail.Subject = "Message from contact page (version: 1.0)"
objNewMail.To = mail_to
objNewMail.Body = emsg & fline
objNewMail.Send
Set objNewMail = Nothing
response.redirect "thankyou.html"
End if
%>
和我的形式我的html code:
And my html code of my form:
<html>
<head>
<title>Formulario Contacto</title>
</head>
<body>
<form method="POST" action="contactusprocess.asp">
<table>
<tr>
<td>Nombres y Apellidos:</td>
<td><input name="Name" size="25" maxlength="50"></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="Email Address" size="25" maxlength="50"></td>
</tr>
<tr>
<td>Telefono o Celular:</td>
<td><input name="Telephone No" size="25" maxlength="50"> </td>
</tr>
<tr>
<td valign="top">Mensaje:</td>
<td><textarea cols="24" name="Message" rows="6"></textarea> </td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<center>
<p>
<input type="submit" value="Enviar" name="Submit">
</p>
</center>
</div>
<div align="center"><center>
</td>
</tr>
</table>
</form>
</body>
</html>
弥服务器是Godaddy的IIS的Windows
Mi Server is Godaddy Windows IIS
我的web.config文件:
My web.config File:
<?xml version="1.0" encoding="utf-8"?>
<!--
Para obtener más información sobre cómo configurar la aplicación de ASP.NET, visite
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<customErrors mode="Off" />
<pages validateRequest="false" />
<globalization culture="es-PE" uiCulture="es-PE" />
<trust level="Low" />
</system.web>
</configuration>
请两天我无法找到一个解决方案。
Please, two days I can not find a solution.
推荐答案
虽然CDONT方法需要对邮件服务器的IIS服务器的配置,该CDO方法不会因为它允许您指定的发送邮件服务器,端口等的你建立的每个消息。下面是使用CDO库参考文本消息的示例框架。
While the CDONT method requires IIS server configuration for a mail server, the CDO method does not as it allow you to specify the outgoing mail server, port, etc as you build each message. Here is a sample framework for a text message using the CDO library reference.
<%
Set cdoMail = CreateObject("CDO.Message")
sFROM = "your_email@gmail.com"
sFROMPWD = "XXXXXX"
sEML = "someone@somewhere.com"
sATTCH = "c:\temp\hello_world.txt"
On Error Resume Next
With cdoMail
With .Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'cdoBasic
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sFROM
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sFROMPWD
.Update
End With
.From = sFROM
.To = sEML
'.CC = ""
'.BCC = ""
.Subject = "Test Mail"
.HTMLBody = "<html><body><p>Mailtest.</p></body></html>"
'.AddAttachment sATTCH
.send
'response.write Err.Number & " - " & Err.Description
'Err.Clear
End With
set cdoMail = nothing
%>
我注释掉一些你可能会感兴趣的领域。我只是跑了我的IIS7箱(带有效凭据考虑在内),并顺利处理。
I've commented out some of the fields that you may find interesting. I just ran that on my IIS7 box (with valid credentials factored in) and it processed without a hitch.
这篇关于内部服务器错误发送表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!