A ver si los talentos en ASP del foro me pueden ayudar con esto: Necesito simplemente poder enviar los resultados de un formulario a un mail, he declarado las dimension variables pertinentes, las he asociado a los inputs correspondientes de un form, y aun asi la unica parte que recibo es la de comentarios (un textarea)
Para ir mas al grano, aqui les pongo el code, este es de un include llamado email-functions.asp
Código:
<%
' ASPMail sender
on error resume next
Select case emailtype
'hay un monton de cases aqui, el que me importa es el de ASPEmail
case "ASPEmail"
Set objNewMail = CreateObject("Persits.MailSender")
objNewMail.From = FromEmail
objNewMail.Host = MailServer
objNewMail.AddAddress YourEmail
objNewMail.Subject = Subject
'nuevas variables a incluir
objNewMail.Address = Address
objNewMail.Email = Email
objNewMail.Country = Country
objNewMail.City = City
objNewMail.State = State
objNewMail.Zip = Zip
objNewMail.Phone1 = Phone1
objNewMail.Phone2 = Phone2
objNewMail.Opt = Opt
objNewMail.Notify = Notify
objNewMail.Body = body
objNewMail.Send
'response.write err.number
%>
Aqui el formulario en HTML que hay que procesar (simplificado):
Código:
<!-- Contact Form -->
<form name="form1" method="post" action="contact_thanks.asp">
Nombre: <input type="text" name="name" size="30" maxlength="30">
Direccion: <input type="text" name="address" size="30" maxlength="50">
Ciudad: <input name="city" type="text" id="city" size="30" maxlength="30">
Estado: <input name="state" type="text" id="state" size="3" maxlength="2">
Zip Code:<input name="zip" type="text" id="zip" size="12" maxlength="11"></td>
Pais:<select name="country" style="margin-left:0 !important;">
<option selected>Select your country</option>
<option value="US">United States</option>
<option value="CA">Canada</option>
<option value="AR">etc etc etc</option>
Email: <input type="text" name="email" size="30" maxlength="30">
Telefono 1:<input type="text" name="phone1" size="12" maxlength="16">
Telefono 2: <input type="text" name="phone2" size="12" maxlength="16">
Opciones:<input name="opt" type="radio" value="sendinfo" checked> Opcion 1
<input type="radio" name="opt" value="question">Opcion 2
<input type="radio" name="opt" value="reservstatus">Opcion 3
<input name="notify" type="checkbox" id="notify" value="yes"> Aviseme cuando haya cambios en el sitio
Comentarios:<textarea cols="29" rows="6" name="body"></textarea></td>
<input type="image" value="submit" src="images/boton_submitform.gif" alt="Submit Form"></td>
</form>
Y finalmente contact_thanks.asp que procesa el form
Código:
<%
Dim Body,Subject
Dim YourEmail, FromEmail
Dim FromName, Mailserver
Dim Address,Country,City,State,Zip,Phone1,Phone2,Opt,Notify
Dim EmailType
YourEmail = "[email protected]"
Mailserver = "mail.email.com"
'##escoger un modelo de mail system ##
'EmailType ="ASPmail"
'EmailType ="cdonts"
'EmailType ="jmail"
EmailType ="ASPEmail"
'EmailType ="OCXMail"
'Request the form elements from the last page
Body = request.form("body")
Subject = request.form("subject")
FromName = request.form("name")
FromEmail = request.form("email")
Address = request.form("address")
Country = request.form("country")
City = request.form ("city")
State = request.form ("state")
Zip = request.form ("zip")
Phone1 = request.form ("phone1")
Phone2 = request.form ("phone2")
Opt = request.form ("opt")
Notify = request.form("notify")
' Now lets send the email by using the include file
%>
<!--#include file ="email-functions.asp"--->
<html>
<head>
<body>
Gracias por llenar el formulario, bla bla bla....
</body>
</html>
La verdad, no se por que razon los otros campos del form no aparecen en el mail que se me envia. Tengo años de no tocar ASP, y seguro que algo basico se me esta olvidando, pero espero que ustedes me digan que sera
gracias