Foros del Web » Programando para Internet » ASP Clásico »

Configuración de formmail

Estas en el tema de Configuración de formmail en el foro de ASP Clásico en Foros del Web. Esta consulta está referida al conocido formulario Matt´s Form Mail El mismo requiere la configuración de la menos 5 campos en el encabezado del mismo ...
  #1 (permalink)  
Antiguo 08/08/2002, 13:25
Avatar de Grayman  
Fecha de Ingreso: junio-2002
Ubicación: No, en realidad, vivo desubicado.
Mensajes: 43
Antigüedad: 22 años, 10 meses
Puntos: 0
Configuración de formmail

Esta consulta está referida al conocido formulario Matt´s Form Mail
El mismo requiere la configuración de la menos 5 campos en el encabezado del mismo y además el de un archivo htm que es el que contiene la información a enviar.
Este archivo tiene algunas variables como recipients, _replyTo, _replyToField, y otros.
Mucho agradeceré a quien me pueda orientar sobre la configuración, tanto del archivo asp como de las variables del htm.
Este es el tercer intento que hago desde estos foros de obtener una respuesta que me permita resolver este problema, hasta ahora, sin suerte.
Muchas Gracias.
  #2 (permalink)  
Antiguo 08/08/2002, 13:42
Avatar de urjose  
Fecha de Ingreso: diciembre-2001
Mensajes: 5.286
Antigüedad: 23 años, 4 meses
Puntos: 1
Re: Configuración de formmail

Esta es la tercera vez que no comprendo. Por que mejor no pones algo de código y listo no conozco eso de Matt Form Mail, alguna página web donde hable de eso? Seguro que es ASP?

Saludos

<center>
<a href=http://comunidadguru.com><img border=0 src=http://comunidadguru.com/imagenes/logos/logo.gif></a>
</center>
  #3 (permalink)  
Antiguo 08/08/2002, 13:53
Avatar de Grayman  
Fecha de Ingreso: junio-2002
Ubicación: No, en realidad, vivo desubicado.
Mensajes: 43
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Configuración de formmail

Gracias, urjose, al menos por preocuparte por leerlo. Sinceramente muchas gracias.
La URL http://www.scriptarchive.com/formmail.html

Y si quieres probar mis frustrados intentos:

http://www.rosariocentral.com/formmail.htm
si completas los datos, (cualquier carácter, pero completa todos los campos) irás a: http://www.rosariocentral.com/formmail.asp
que muestra cómo no funciona
  #4 (permalink)  
Antiguo 08/08/2002, 14:11
Avatar de urjose  
Fecha de Ingreso: diciembre-2001
Mensajes: 5.286
Antigüedad: 23 años, 4 meses
Puntos: 1
Re: Configuración de formmail

1.- No puedo entrar a tu página
2.- En la documentación nnunca habla de ASP, es mas creo que esta hecho con Perl.

COmo dije antes,Coloca tu codigo.

<center>
<a href=http://comunidadguru.com><img border=0 src=http://comunidadguru.com/imagenes/logos/logo.gif></a>
</center>
  #5 (permalink)  
Antiguo 08/08/2002, 14:20
Avatar de Grayman  
Fecha de Ingreso: junio-2002
Ubicación: No, en realidad, vivo desubicado.
Mensajes: 43
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Configuración de formmail

Estas son las variables configurables del archivo asp

referers = Array(&quot;www.rosariocentral.com&quot;, &quot;rosariocentral.com&quot;)
mailComp = &quot;CDONTS&quot;
smtpServer = &quot;smtp.rosariocentral.com&quot;
fromAddr = &quot;[email protected]&quot;

Y estas la del archivo htm
&lt;input name=&quot;_subject&quot; type=&quot;hidden&quot; value=&quot;Newsletter Signup&quot;&gt;
&lt;input name=&quot;_replyToField&quot; type=&quot;hidden&quot; value=&quot;Email Address&quot;&gt;
&lt;input name=&quot;_requiredFields&quot; type=&quot;hidden&quot; value=&quot;Customer Name, Address, City, State, Zip Code, Email Address, Delivery&quot;&gt;
&lt;input name=&quot;_envars&quot; type=&quot;hidden&quot; value=&quot;HTTP_REFERER, HTTP_USER_AGENT, REMOTE_ADDR&quot;&gt;
&lt;input name=&quot;recipients&quot; type=&quot;hidden&quot; value=&quot;[email protected]&quot;&gt;

Esta es la configuración con la que actualmente no funciona.

Espero que con esto se entienda mejor. ¿O no?

Gracias de todos modos
  #6 (permalink)  
Antiguo 08/08/2002, 14:24
Avatar de urjose  
Fecha de Ingreso: diciembre-2001
Mensajes: 5.286
Antigüedad: 23 años, 4 meses
Puntos: 1
Re: Configuración de formmail

A todo esto que error te manda?

Cuando quiero entrar a tu formulario me pide que me loguee.

Saludos

<center>
<a href=http://comunidadguru.com><img border=0 src=http://comunidadguru.com/imagenes/logos/logo.gif></a>
</center>
  #7 (permalink)  
Antiguo 08/08/2002, 14:33
Avatar de Grayman  
Fecha de Ingreso: junio-2002
Ubicación: No, en realidad, vivo desubicado.
Mensajes: 43
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Configuración de formmail

El error que aparece es:

Missing email recipient.

Ya que eres tan atento y si tienes tiempo vuelvo a enviarte las URL donde está el formulario que no funciona:

http://www.rosariocentral.com/formmail.htm

Gracias.
  #8 (permalink)  
Antiguo 08/08/2002, 14:38
Avatar de urjose  
Fecha de Ingreso: diciembre-2001
Mensajes: 5.286
Antigüedad: 23 años, 4 meses
Puntos: 1
Re: Configuración de formmail

Como que falta mas codigo del archivo .asp no?

Colocalo aqui.

<center>
<a href=http://comunidadguru.com><img border=0 src=http://comunidadguru.com/imagenes/logos/logo.gif></a>
</center>
  #9 (permalink)  
Antiguo 08/08/2002, 14:47
Avatar de Grayman  
Fecha de Ingreso: junio-2002
Ubicación: No, en realidad, vivo desubicado.
Mensajes: 43
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Configuración de formmail

&lt;%@ LANGUAGE=&quot;VBScript&quot; %&gt;

&lt;% '************************************************* **************************
'* ASP FormMail *
'* *
'* Copyright 1999, 2000 by Mike Hall. *
'* Please see http://www.brainjar.com for documentation and terms of use. *
'************************************************* **************************

'- Customization of these values is required, see documentation. -----------

referers = Array(&quot;www.rosariocentral.com&quot;, &quot;rosariocentral.com&quot;)
mailComp = &quot;CDONTS&quot;
smtpServer = &quot;smtp.rosariocentral.com&quot;
fromAddr = &quot;[email protected]&quot;

'- End required customization section. -------------------------------------

Response.Buffer = true
errorMsgs = Array()

'Check for form data.

if Request.ServerVariables(&quot;Content_Length&quot; ) = 0 then
call AddErrorMsg(&quot;No form data submitted.&quot;)
end if

'Check if referer is allowed.

validReferer = false
referer = GetHost(Request.ServerVariables(&quot;HTTP_REFERER &quot;))
for each host in referers
if host = referer then
validReferer = true
end if
next
if not validReferer then
if referer = &quot;&quot; then
call AddErrorMsg(&quot;No referer.&quot;)
else
call AddErrorMsg(&quot;Invalid referer: '&quot; &amp; referer &amp; &quot;'.&quot;)
end if
end if

'Check for the recipients field.

if Request.Form(&quot;_recipients&quot;) = &quot;&quot; then
call AddErrorMsg(&quot;Missing email recipient.&quot;)
end if

'Check all recipient email addresses.

recipients = Split(Request.Form(&quot;_recipients&quot;), &quot;,&quot;)
for each name in recipients
name = Trim(name)
if not IsValidEmail(name) then
call AddErrorMsg(&quot;Invalid email address in recipient list: &quot; &amp; name &amp; &quot;.&quot;)
end if
next
recipients = Join(recipients, &quot;,&quot;)

'Get replyTo email address from specified field if given and check it.

name = Trim(Request.Form(&quot;_replyToField&quot;))
if name &lt;&gt; &quot;&quot; then
replyTo = Request.Form(name)
else
replyTo = Request.Form(&quot;_replyTo&quot;)
end if
if replyTo &lt;&gt; &quot;&quot; then
if not IsValidEmail(replyTo) then
call AddErrorMsg(&quot;Invalid email address in reply-to field: &quot; &amp; replyTo &amp; &quot;.&quot;)
end if
end if

'Get subject text.

subject = Request.Form(&quot;_subject&quot;)

'If required fields are specified, check for them.

if Request.Form(&quot;_requiredFields&quot;) &lt;&gt; &quot;&quot; then
required = Split(Request.Form(&quot;_requiredFields&quot;), &quot;,&quot;)
for each name in required
name = Trim(name)
if Left(name, 1) &lt;&gt; &quot;_&quot; and Request.Form(name) = &quot;&quot; then
call AddErrorMsg(&quot;Missing value for &quot; &amp; name)
end if
next
end if

'If a field order was given, use it. Otherwise use the order the fields were
'received in.

str = &quot;&quot;
if Request.Form(&quot;_fieldOrder&quot;) &lt;&gt; &quot;&quot; then
fieldOrder = Split(Request.Form(&quot;_fieldOrder&quot;), &quot;,&quot;)
for each name in fieldOrder
if str &lt;&gt; &quot;&quot; then
str = str &amp; &quot;,&quot;
end if
str = str &amp; Trim(name)
next
fieldOrder = Split(str, &quot;,&quot;)
else
fieldOrder = FormFieldList()
end if

'If there were no errors, build the email note and send it.

if UBound(errorMsgs) &lt; 0 then

'Build table of form fields and values.

body = &quot;&lt;table border=0 cellpadding=2 cellspacing=0&gt;&quot; &amp; vbCrLf
for each name in fieldOrder
body = body _
&amp; &quot;&lt;tr valign=top&gt;&quot; _
&amp; &quot;&lt;td&gt;&lt;font face=&quot;&quot;Arial,Helvetica&quot;&quot; size=2&gt;&lt;b&gt;&quot; _
&amp; name _
&amp; &quot;:&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&quot; _
&amp; &quot;&lt;td&gt;&lt;font face=&quot;&quot;Arial,Helvetica&quot;&quot; size=2&gt;&quot; _
&amp; Request.Form(name) _
&amp; &quot;&lt;/font&gt;&lt;/td&gt;&quot; _
&amp; &quot;&lt;/tr&gt;&quot; &amp; vbCrLf
next
body = body &amp; &quot;&lt;/table&gt;&quot; &amp; vbCrLf

'Add a table with any environmental variables.

if Request.Form(&quot;_envars&quot;) &lt;&gt; &quot;&quot; then
body = body _
&amp; &quot;&lt;p&gt;&quot; _
&amp; &quot;&lt;table border=0 cellpadding=2 cellspacing=0&gt;&quot; &amp; vbCrLf
envars = Split(Request.Form(&quot;_envars&quot;), &quot;,&quot;)
for each name in envars
name = Trim(name)
body = body _
&amp; &quot;&lt;tr valign=top&gt;&quot; _
&amp; &quot;&lt;td&gt;&lt;font face=&quot;&quot;Arial,Helvetica&quot;&quot; size=2&gt;&lt;b&gt;&quot; _
&amp; name _
&amp; &quot;:&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&quot; _
&amp; &quot;&lt;td&gt;&lt;font face=&quot;&quot;Arial,Helvetica&quot;&quot; size=2&gt;&quot; _
&amp; Request.ServerVariables(name) _
&amp; &quot;&lt;/font&gt;&lt;/td&gt;&quot; _
&amp; &quot;&lt;/tr&gt;&quot; &amp; vbCrLf
next
body = body &amp; &quot;&lt;/table&gt;&quot; &amp; vbCrLf
end if

'Send it.

str = SendMail()
if str &lt;&gt; &quot;&quot; then
AddErrorMsg(str)
end if

'Redirect if a URL was given.

if Request.Form(&quot;_redirect&quot;) &lt;&gt; &quot;&quot; then
Response.Redirect(Request.Form(&quot;_redirect&quo t;))
end if

end if %&gt;
  #10 (permalink)  
Antiguo 08/08/2002, 14:50
Avatar de Grayman  
Fecha de Ingreso: junio-2002
Ubicación: No, en realidad, vivo desubicado.
Mensajes: 43
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Configuración de formmail

&lt;% '---------------------------------------------------------------------------
' Subroutines and functions.
'---------------------------------------------------------------------------

sub AddErrorMsg(msg)

dim n

'Add an error message to the list.

n = UBound(errorMsgs)
Redim Preserve errorMsgs(n + 1)
errorMsgs(n + 1) = msg

end sub

function GetHost(url)

Dim i, s

GetHost = &quot;&quot;

'Strip down to host or IP address and port number, if any.

if Left(url, 7) = &quot;http://&quot; then
s = Mid(url, 8)
elseif Left(url, 8) = &quot;https://&quot; then
s = Mid(url, 9)
end if
i = InStr(s, &quot;/&quot;)
if i &gt; 1 then
s = Mid(s, 1, i - 1)
end if

getHost = s

end function

function IsValidEmail(email)

dim names, name, i, c

'Check for valid syntax in an email address.

IsValidEmail = true
names = Split(email, &quot;@&quot;)
if UBound(names) &lt;&gt; 1 then
IsValidEmail = false
exit function
end if
for each name in names
if Len(name) &lt;= 0 then
IsValidEmail = false
exit function
end if
for i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
if InStr(&quot;abcdefghijklmnopqrstuvwxyz_-.&quot;, c) &lt;= 0 and not IsNumeric(c) then
IsValidEmail = false
exit function
end if
next
if Left(name, 1) = &quot;.&quot; or Right(name, 1) = &quot;.&quot; then
IsValidEmail = false
exit function
end if
next
if InStr(names(1), &quot;.&quot;) &lt;= 0 then
IsValidEmail = false
exit function
end if
i = Len(names(1)) - InStrRev(names(1), &quot;.&quot;)
if i &lt;&gt; 2 and i &lt;&gt; 3 then
IsValidEmail = false
exit function
end if
if InStr(email, &quot;..&quot;) &gt; 0 then
IsValidEmail = false
end if

end function

function FormFieldList()

dim str, i, name

'Build an array of form field names ordered as they were received.

str = &quot;&quot;
for i = 1 to Request.Form.Count
for each name in Request.Form
if Left(name, 1) &lt;&gt; &quot;_&quot; and Request.Form(name) is Request.Form(i) then
if str &lt;&gt; &quot;&quot; then
str = str &amp; &quot;,&quot;
end if
str = str &amp; name
exit for
end if
next
next
FormFieldList = Split(str, &quot;,&quot;)

end function

function SendMail()

dim mailObj
dim addrList

'Send email based on mail component. Uses global variables for parameters
'because there are so many.

SendMail = &quot;&quot;

'Send email (CDONTS version), doesn't support reply to address and has
'no error checking.

if mailComp = &quot;CDONTS&quot; then
set mailObj = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
mailObj.BodyFormat = 0
mailObj.MailFormat = 0
mailObj.From = fromAddr
mailObj.To = recipients
mailObj.Subject = subject
mailObj.Body = body
mailObj.Send
end if

'Send email (JMail version).

if mailComp = &quot;JMail&quot; then
set mailObj = Server.CreateObject(&quot;JMail.SMTPMail&quot;)
mailObj.Silent = true
mailObj.ServerAddress = smtpServer
mailObj.Sender = fromAddr
mailObj.ReplyTo = replyTo
mailObj.Subject = subject
addrList = Split(recipients, &quot;,&quot;)
for each addr in addrList
mailObj.AddRecipient Trim(addr)
next
mailObj.ContentType = &quot;text/html&quot;
mailObj.Body = body
if not mailObj.Execute then
SendMail = &quot;Email send failed: &quot; &amp; mailObj.ErrorMessage &amp; &quot;.&quot;
end if
end if

'Send email (ASPMail version).

if mailComp = &quot;ASPMail&quot; then
set mailObj = Server.CreateObject(&quot;SMTPsvg.Mailer&quot;)
mailObj.FromAddress = fromAddr
mailObj.RemoteHost = smtpServer
mailObj.ReplyTo = replyTo
for each addr in Split(recipients, &quot;,&quot;)
mailObj.AddRecipient &quot;&quot;, Trim(addr)
next
mailObj.Subject = subject
mailObj.ContentType = &quot;text/html&quot;
mailObj.BodyText = body
if not mailObj.SendMail then
SendMail = &quot;Email send failed: &quot; &amp; mailObj.Response &amp; &quot;.&quot;
end if
end if

end function %&gt;

  #11 (permalink)  
Antiguo 08/08/2002, 14:52
Avatar de Grayman  
Fecha de Ingreso: junio-2002
Ubicación: No, en realidad, vivo desubicado.
Mensajes: 43
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Configuración de formmail

Bueno, urjose, no sé si lo que hice es correcto, pero, en dos partes, ese es todo el código (con excepción del htm) que está en el archivo formmail.asp

Gracias.
  #12 (permalink)  
Antiguo 08/08/2002, 15:02
Avatar de urjose  
Fecha de Ingreso: diciembre-2001
Mensajes: 5.286
Antigüedad: 23 años, 4 meses
Puntos: 1
Re: Configuración de formmail

Tu tienes esto:

&lt;input name=&quot;recipients&quot; type=&quot;hidden&quot; value=&quot;[email protected]&quot;&gt;

Y creo que debe ser así:

&lt;input name=&quot;_recipients&quot; type=&quot;hidden&quot; value=&quot;[email protected]&quot;&gt;

Aunque el manual diga otra cosa.

Saludos

<center>
<a href=http://comunidadguru.com><img border=0 src=http://comunidadguru.com/imagenes/logos/logo.gif></a>
</center>
  #13 (permalink)  
Antiguo 08/08/2002, 15:17
Avatar de Grayman  
Fecha de Ingreso: junio-2002
Ubicación: No, en realidad, vivo desubicado.
Mensajes: 43
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Configuración de formmail

Lamentablemente no puedo probar la modificación porque en este momento se ha caido el acceso ftp al servidor.
Señal de que es muy probable que esta modificación funcione.
Cuando pueda probarlos te aviso.

Siempre, mucas gracias
  #14 (permalink)  
Antiguo 08/08/2002, 15:52
Avatar de Grayman  
Fecha de Ingreso: junio-2002
Ubicación: No, en realidad, vivo desubicado.
Mensajes: 43
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Configuración de formmail

No, con esa modificación tampoco anduvo.

Agradezco mucho tu atención y compromiso.
  #15 (permalink)  
Antiguo 08/08/2002, 20:06
 
Fecha de Ingreso: enero-2002
Mensajes: 1.174
Antigüedad: 23 años, 3 meses
Puntos: 21
Re: Configuración de formmail

Estimado Grayman,

Yo he empleado el FormMail desde la versión 1.4. Ya está en la 1.91 y es fabulosa. Tengo hasta carritos de compra con esa utilería.

Te comento que lo he implementado en Perl bajo Linux. Si me dices de donde puedes bajar la versión para ASP te podré ayudar ya que estoy interesado en implementarlo en esta plataforma.

Saludos.
  #16 (permalink)  
Antiguo 08/08/2002, 20:36
Avatar de Grayman  
Fecha de Ingreso: junio-2002
Ubicación: No, en realidad, vivo desubicado.
Mensajes: 43
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Configuración de formmail

Hola Bier

Gracias por tu respuesta. En realidad yo de esto no conozco nada. Te comento: el proveedor de hosting que aloja el sitio en el que estoy trabajando provee, entre otros, esta utilería para componer los formularios de envío de correo vía web.

En este caso proveen dos archivos, uno, genéricamente llamado test.html que contiene el formulario propiamente dicho y con algunas variables configurables. El otro archivo, llamado formmail.asp que teóricamente es el que ejecuta el post de los datos insertados en el archivo htm.

El caso es que no logro hacerlo funcionar. Si quieres probarlo puedes acceder desde <a href='ir.asp?http://www.rosariocentral.com/formmail.htm' target='_blank'>http://www.rosariocentral.com/formmail.h...</a>, completando todos los datos (esto es necesario por no estar configurado el campo _requiredFields) vas a tener acceso a <a href='ir.asp?http://www.rosariocentral.com/formmail.asp' target='_blank'>http://www.rosariocentral.com/formmail.a...</a> y apreciar el error en el funcionamiento.

Sinceramente no sé si este último está hecho en asp o en otro lenguaje. Creo, de todos modos que es una utilería bastante popular e imagino que no será tan difícil su configuración.

Los archivos originales están (creo) en <a href='ir.asp?http://www.scriptarchive.com/formmail.html' target='_blank'>http://www.scriptarchive.com/formmail.ht...</a>

Agradezco tu interés como así también cualquier dato que me puedas dar para solucionar este pequeño inconveniente.

Saludos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:53.