meu servidor me passou o seguinte código de formulário, quando preencho o formulário e dou um enviar segue a seguinte mensagem
O formulário não pôde ser processado devido aos seguintes erros:
E-mail do destinatário não informado.
onde esta o erro desde já agradeço
<%@ LANGUAGE="VBScript" %>
<% '***************************************************************************
'* FormMail em ASP - Distribuído por Hosted Hospedagem *
'* [url=http://www.hosted.com.br/]http://www.hosted.com.br/[/url] *
'***************************************************************************
'- Definir referências com permissão de uso. -----------
referers = Array("www.lddesigners.com", "lddesigners.com")
smtpServer = "localhost"
fromAddr = "formmail@lddesigners.com"
'- Fim da definição de referências -------------------------------------
mailComp = "CDOSYS"
Response.Buffer = true
errorMsgs = Array()
if Request.ServerVariables("Content_Length") = 0 then
call AddErrorMsg("Nenhum dado foi enviado a partir do formulário.")
end if
if UBound(referers) >= 0 then
validReferer = false
referer = GetHost(Request.ServerVariables("HTTP_REFERER"))
for each host in referers
if host = referer then
validReferer = true
end if
next
if not validReferer then
if referer = "" then
call AddErrorMsg("Sem referência.")
else
call AddErrorMsg("Referência Inválida: '" & referer & "'.")
end if
end if
end if
if Request.Form("_recipients") = "" then
call AddErrorMsg("E-mail do destinatário não informado.")
end if
recipients = Split(Request.Form("_recipients"), ",")
for each name in recipients
name = Trim(name)
if not IsValidEmailAddress(name) then
call AddErrorMsg("E-mail de destinatário inválido: " & name & ".")
end if
next
recipients = Join(recipients, ",")
name = Trim(Request.Form("_replyToField"))
if name <> "" then
replyTo = Request.Form(name)
else
replyTo = Request.Form("_replyTo")
end if
if replyTo <> "" then
if not IsValidEmailAddress(replyTo) then
call AddErrorMsg("E-mail inválido no campo reply-to (responder a): " & replyTo & ".")
end if
end if
subject = Request.Form("_subject")
if Request.Form("_requiredFields") <> "" then
required = Split(Request.Form("_requiredFields"), ",")
for each name in required
name = Trim(name)
if Left(name, 1) <> "_" and Request.Form(name) = "" then
call AddErrorMsg("Faltando valor em " & name)
end if
next
end if
str = ""
if Request.Form("_fieldOrder") <> "" then
fieldOrder = Split(Request.Form("_fieldOrder"), ",")
for each name in fieldOrder
if str <> "" then
str = str & ","
end if
str = str & Trim(name)
next
fieldOrder = Split(str, ",")
else
fieldOrder = FormFieldList()
end if
if UBound(errorMsgs) < 0 then
body = "<table border=""0"" cellpadding=""2"" cellspacing=""0"">" & vbCrLf
for each name in fieldOrder
body = body _
& "<tr valign=""top"">" _
& "<td><b>" & name & ":</b></td>" _
& "<td>" & Request.Form(name) & "</td>" _
& "</tr>" & vbCrLf
next
body = body & "</table>" & vbCrLf
if Request.Form("_envars") <> "" then
body = body _
& "<p> </p>" & vbCrLf _
& "<table border=""0"" cellpadding=""2"" cellspacing=""0"">" & vbCrLf
envars = Split(Request.Form("_envars"), ",")
for each name in envars
name = Trim(name)
body = body _
& "<tr valign=""top"">" _
& "<td><b>" & name & ":</b></td>" _
& "<td>" & Request.ServerVariables(name) & "</td>" _
& "</tr>" & vbCrLf
next
body = body & "</table>" & vbCrLf
end if
str = SendMail()
if str <> "" then
AddErrorMsg(str)
end if
if Request.Form("_redirect") <> "" then
Response.Redirect(Request.Form("_redirect"))
end if
end if %>
<html>
<head>
<title>Form Mail ASP</title>
<style type="text/css">
body {
background-color: #ffffff;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
}
table {
border: solid 1px #000000;
border-collapse: collapse;
}
td, th {
border: solid 1px #000000;
border-collapse: collapse;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
padding: 2px;
padding-left: 8px;
padding-right: 8px;
}
th {
background-color: #c0c0c0;
}
.error {
color: #c00000;
}
</style>
</head>
<body>
<% if UBound(errorMsgs) >= 0 then %>
<p class="error">O formulário não pôde ser processado devido aos seguintes erros:</p>
<ul>
<% for each msg in errorMsgs %>
<li class="error"><% = msg %></li>
<% next %>
</ul>
<% else %>
<table cellpadding="0" cellspacing="0">
<tr>
<th colspan="2" valign="bottom">
Obrigado, os dados abaixo foram enviados:
</th>
</tr>
<% for each name in fieldOrder %>
<tr valign="top">
<td><b><% = name %></b></td>
<td><% = Request.Form(name) %></td>
</tr>
<% next %>
</table>
<% end if %>
</body>
</html>
<% '---------------------------------------------------------------------------
' Funções.
'---------------------------------------------------------------------------
sub AddErrorMsg(msg)
dim n
n = UBound(errorMsgs)
Redim Preserve errorMsgs(n + 1)
errorMsgs(n + 1) = msg
end sub
function GetHost(url)
dim i, s
GetHost = ""
if Left(url, 7) = "http://" then
s = Mid(url, 8)
elseif Left(url, 8) = "https://" then
s = Mid(url, 9)
end if
i = InStr(s, "/")
if i > 1 then
s = Mid(s, 1, i - 1)
end if
getHost = s
end function
dim validTlds
function IsValidEmailAddress(emailAddr)
dim i, localPart, domain, charCode, subdomain, subdomains, tld
IsValidEmailAddress = true
i = InStrRev(emailAddr, "@")
if i <= 1 then
IsValidEmailAddress = false
exit function
end if
localPart = Left(emailAddr, i - 1)
domain = Mid(emailAddr, i + 1)
if Len(localPart) < 1 or Len(domain) < 3 then
IsValidEmailAddress = false
exit function
end if
for i = 1 to Len(localPart)
charCode = Asc(Mid(localPart, i, 1))
if charCode < 32 or charCode >= 127 then
IsValidEmailAddress = false
exit function
end if
next
domain = LCase(domain)
for i = 1 to Len(domain)
charCode = Asc(Mid(domain, i, 1))
if not ((charCode >= 97 and charCode <= 122) or (charCode >= 48 and charCode <= 57) or charCode = 45 or charCode = 46) then
IsValidEmailAddress = false
exit function
end if
next
subdomains = Split(domain, ".")
for each subdomain in subdomains
if Len(subdomain) < 1 then
IsValidEmailAddress = false
exit function
end if
next
tld = subdomains(UBound(subdomains))
if not IsArray(validTlds) then
call SetValidTlds()
end if
for i = LBound(validTlds) to UBound(validTlds)
if tld = validTlds(i) then
exit function
end if
next
IsValidEmailAddress = false
end function
sub setValidTlds()
validTlds = Array("aero", "biz", "com", "coop", "edu", "gov", "info", "int", "mil", "museum", "name", "net", "org", "pro", _
"ac", "ad", "ae", "af", "ag", "ai", "al", "am", "an", "ao", "aq", "ar", "as", "at", "au", "aw", "az", _
"ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo", "br", "bs", "bt", "bv", "bw", "by", "bz", _
"ca", "cc", "cd", "cf", "cg", "ch", "ci", "ck", "cl", "cm", "cn", "co", "cr", "cu", "cv", "cx", "cy", "cz", _
"de", "dj", "dk", "dm", "do", "dz", "ec", "ee", "eg", "é", "er", "es", "et", _
"fi", "fj", "fk", "fm", "fo", "fr", _
"ga", "gd", "ge", "gf", "gg", "gh", "gi", "gl", "gm", "gn", "gp", "gq", "gr", "gs", "gt", "gu", "gw", "gy", _
"hk", "hm", "hn", "hr", "ht", "hu", _
"id", "ie", "il", "im", "in", "io", "iq", "ir", "is", "it", _
"je", "jm", "jo", "jp", _
"ke", "kg", "kh", "que", "km", "kn", "kp", "kr", "kw", "ky", "kz", _
"la", "lb", "lc", "li", "lk", "lr", "ls", "lt", "lu", "lv", "ly", _
"ma", "mc", "md", "mg", "mh", "mk", "ml", "mm", "mn", "mo", "mp", "mq", "mr", "ms", "muito", "mu", "mv", "mw ", "mx", "my", "mz", _
"na", "nc", "ne", "nf", "ng", "ni", "nl", "no", "np", "nr", "nu", "nz", _
"om", _
"pa", "pe", "pf", "pg", "ph", "pk", "pl", "pm", "pn", "pr", "ps", "pt", "pw", "py", _
"qa", _
"re", "ro", "ru", "rw", _
"sa", "sb", "sc", "sd", "se", "sg", "sh", "si", "sj", "sk", "sl", "sm", "sn", "so", "sr", "st", "sv", "sy", "sz", _
"tc", "td", "tf", "tg", "th", "tj", "tk", "tm", "tn", "to", "tp", "tr", "tt", "tv", "tw", "tz", _
"ua", "ug", "uk", "um", "us", "uy", "uz", _
"va", "você", "ve", "vg", "vi", "vn", "vu", _
"wf", "ws", _
"ye", "yt", "yu", _
"za", "zm", "zw")
end sub
function FormFieldList()
dim str, i, name
str = ""
for i = 1 to Request.Form.Count
for each name in Request.Form
if Left(name, 1) <> "_" and Request.Form(name) is Request.Form(i) then
if str <> "" then
str = str & ","
end if
str = str & name
exit for
end if
next
next
FormFieldList = Split(str, ",")
end function
function SendMail()
dim mailObj, cdoMessage, cdoConfig
dim addrList
SendMail = ""
if mailComp = "CDOSYS" then
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
cdoConfig.Fields.Update
set cdoMessage.Configuration = cdoConfig
cdoMessage.From = fromAddr
cdoMessage.ReplyTo = replyTo
cdoMessage.To = recipients
cdoMessage.Subject = subject
cdoMessage.HtmlBody = body
on error resume next
cdoMessage.Send
if Err.Number <> 0 then
SendMail = "Email send failed: " & Err.Description & "."
end if
set cdoMessage = Nothing
set cdoConfig = Nothing
exit function
end if
end function %>
Pergunta
Guest Dic Vigarista
meu servidor me passou o seguinte código de formulário, quando preencho o formulário e dou um enviar segue a seguinte mensagem
O formulário não pôde ser processado devido aos seguintes erros:
E-mail do destinatário não informado.
onde esta o erro desde já agradeço
Link para o comentário
Compartilhar em outros sites
4 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.