
05/06/2007, 04:41
|
 | | | Fecha de Ingreso: enero-2002 Ubicación: Madrid
Mensajes: 550
Antigüedad: 23 años, 3 meses Puntos: 4 | |
seleccion múltiple Hola a todos tengo este código para enviar desde un formulario un correo con info, que a su vez se mete a una base de datos, aquí normalmente solicitan más info de los productos y alguien hace el envío de los mails con la info, la cuestión es: como hago para que en lugar de que en observaciones ponganq ue quieren más info de x o y producto ellos puedan seleccionar todos los productos de los que quieren info y solo se vaya un solo registro a la web ocn estas solicitudes.
Este es el código:
Código:
<%@ Language = VBScript%>
<%Function LeerArchivo (ByVal UbicacionyNombre)
Const Lectura = 1
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'If UbicacionyNombre <> "" Then
' UbicacionyNombre = Replace(UbicacionyNombre, " ", "%20")
'End If
'Response.Write UbicacionyNombre & "<br>"
'Response.End
On Error Resume Next
If objFSO.FileExists(UbicacionyNombre) then
Set objText = objFSO.OpenTextFile(UbicacionyNombre, Lectura)
LeerArchivo = objText.ReadAll
objText.Close
'Response.Write "SI"
Set objText = Nothing
Else
LeerArchivo = ""
'Response.Write "NO"
End If
Set objFSO = Nothing
End Function%>
<%Function EnviarEmailHtml(ByVal Servidor_de_Correo, ByVal Nombre_De, ByVal Correo_De, ByVal Correo_Para, ByVal Asunto, ByVal Mensaje, ByVal Prioridad)
Set JmailHtml = CreateObject("JMail.SMTPMail")
JmailHtml.ServerAddress = Servidor_de_Correo
JmailHtml.SenderName = Nombre_De
JmailHtml.Sender = Correo_De
JmailHtml.AddRecipient Correo_Para
JmailHtml.Subject = Asunto
JmailHtml.Priority = Prioridad
JmailHtml.Charset = "iso-8859-1"
JmailHtml.ContentType = "text/html"
JmailHtml.HTMLBody = Mensaje
On Error Resume Next
JmailHtml.Execute
If Err.number = 0 Then
EnviarEmailHtml = 1
Else
EnviarEmailHtml = 0
Err.Clear
End If
Set JmailHtml = Nothing
End Function%>
<%Ip = Request.ServerVariables("Remote_Host")%>
<html>
<head>
<title>EMPRESA</title>
</head>
<body bgcolor="#af1e2d" text="#fff" link="#125699" vlink="#9c7384">
<center>
<%If Ip = "213.37.49.233" Then%>
<table border="0" cellpadding="0" cellspacing="0" align=center width=490>
<%Else%>
<table border="0" cellpadding="0" cellspacing="0" align=center width=490 height=180>
<%End If%>
<tr>
<td align=center>
<a href="javascript:self.close();"><img src="images/cerrar.gif" border="0" width="89" height="55"></a>
</td>
</tr>
</table>
</body>
</html>
<%Producto = Trim(Request("producto"))
If Len(Promocion) > 3 Then
MatProducto = Split(Producto,"@")
CodProducto = MatProducto(0)
NomProducto = MatProducto(1)
End If
If Ip = "213.37.49.233" Then
Response.Write Producto
Response.End
End If
If CodProducto <> "" Then
CodProducto = Replace(LCase(CodProducto),"-","")
CodProducto = Replace(LCase(CodProducto)," ","")
'Response.Write CodProducto
'Response.End
Archivo = LeerArchivo("E:\wwwroot\empresa\mailing\" & CodProducto & "\" & CodProducto & ".htm")
Else
Archivo = ""
CorreoEnviado = 0
End If
If Len(Archivo) > 100 Then
NombreDe = "Dpto. Comercial -EMPRESA-"
CorreoDe = "[email protected]"
CorreoPara = Trim(Request.Form("email"))
Asunto = "NOMBRE EMPRESA - Información " & UCase(NomPromocion) & " "
CorreoEnviado = EnviarEmailHtml("servidor.es", NombreDe, CorreoDe, CorreoPara, Asunto, Archivo, 3)
'Call EnviarEmailHtml("servidores", NombreDe, "[email protected]", "[email protected]", CorreoEnviado & "-" & Asunto, Archivo, 5)
'Response.Write Asunto & "<br>" & Archivo
End If%>
<%Nombre = Trim(request.form("nombre"))
Direccion = Trim(request.form("direccion"))
Localidad = Trim(request.form("localidad"))
Provincia = Trim(request.form("provincia"))
CodigoP = Trim(request.form("cp"))
Pais = Trim(request.form("pais"))
Telefono = Trim(request.form("tel"))
Email = Trim(request.form("email"))
Producto = Trim(request.form("producto"))
If Len(Promocion) > 3 Then
MatProducto = Split(Producto,"@")
CodProducto = MatProducto(0)
Promocion = MatPromocion(1)
End If
Observaciones = Trim(request.form("observaciones"))
'------------------------------------------------
' ENVIAMOS LOS DATOS A LA BASE DE DATOS
'------------------------------------------------
' Comprobamos que ha rellenado algún campo del formulario
if request.form = "" then
hayDatos = false
else
hayDatos = false
end if
' Si hay algún campo relleno entonces lo metemos en la base de datos,
' de lo contrario no tocamos la base de datos para nada.
if hayDatos then
'Abrimos la conexión
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "FILEDSN=E:\bd\solicitudes.dsn"
'Ahora creamos la sentencia SQL
sSQL="INSERT INTO Solicitudes (nombreyapellidos,direccion,ciudad,provincia,codigopostal,pais,telefono,correoelectronico,promocioninteres,observaciones,correoenviado) values ('" & Nombre & "','" & Direccion & "','" & Localidad & "','" & Provincia & "','" & CodigoP & "','" & Pais & "','" & Telefono & "','" & Email & "','" & Promocion & "','" & Observaciones & "','" & CorreoEnviado & "')"
'Ejecutamos la orden
Conn.Execute(sSQL)
'Cerramos la conexion
Conn.Close
Set Conn = NoThing
end if
'------------------------------------------------
Sugerencia=Sugerencia & "NOMBRE: " & Nombre & vbCrLf
Sugerencia=Sugerencia & "DIRECCION: " & Direccion & vbCrLf
Sugerencia=Sugerencia & "LOCALIDAD: " & Localidad & vbCrLf
Sugerencia=Sugerencia & "PROVINCIA: " & Provincia & vbCrLf
Sugerencia=Sugerencia & "CODIGOP: " & CodigoP & vbCrLf
Sugerencia=Sugerencia & "PAIS: " & Pais & vbCrLf
Sugerencia=Sugerencia & "TELEFONO: " & Telefono & vbCrLf
Sugerencia=Sugerencia & "EMAIL: " & Email & vbCrLf
Sugerencia=Sugerencia & "PRODUCTO: " & Producto & vbCrLf
Sugerencia=Sugerencia & "OBSERVACIONES: " & Observaciones & vbCrLf
Set smtp = Server.CreateObject("Bamboo.SMTP")
smtp.Server = "smtp.eol.es"
smtp.Rcpt = "[email protected]"
smtp.From = Mail
smtp.FromName = Request("Email")
smtp.Subject = "PETICION DE INFORMACION DE USUARIOS DE LA WEB PRYCONSA"
smtp.Message = Sugerencia
on error resume next
smtp.Send
if err <> 0 then
Response.Write ("ERROR enviando el Correo")
Response.End
else
Response.Write("<b>Gracias por su petición<br>en breve recibirá la información solicitada")
end if
Set smtp = NoThing%>
Espero no sea mucho coñazo
__________________ Temiqui Iztoc Cualtlia Elhuayotl |