Ir para conteúdo
Fórum Script Brasil
  • 0

Como Enviar Através De Formmail Um Carrinho De Compras?


Caio Rebello

Pergunta

Fala galera, sou novo aqui no fórum, e novo na arte de programar :unsure: , mas sempre visito o script brasil, porque voces tem um bom banco de dados de scripts, e muito bons tutoriais.

O meu problema é o seguinte, peguei um sistema de carrinho de compras pronto, dei uma arrumada nele para poder enviar através do formmail os dados contidos nele.

Esse é o código da página do carrinho de compras:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Shop Márcia Spassapan</title>
<link rel="STYLESHEET" type="text/css" href="../br/scripts/css_ms.css">
</head>
<body bgcolor="#FFEFFF">
<!--#include file='db.asp'-->
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#990066">
  <tr>
    <td height="35" align="center" valign="middle" class="Title_Geral_Maior">Apostilas Para Pintura M&aacute;rcia Spassapan</td>
  </tr>
</table>
<br>
<div align="center" class="Conteudo">Chegaram as novas edi&ccedil;&otilde;es das Apostilas Para Pintura m&aacute;rcia Spassapan<br />
Escolha abaixo a sua</div>
<br />
<br />
<table width="400" border="1" cellpadding="1" cellspacing="1" align="center" bgcolor="#FFFFFF">
  <tr>
    <td align="center" valign="middle"><div align="center"><b class="Artista_Title">Carrinho de Compras</b>
      <p align="center">

<%
    ' ***** GET NUMBER OF DISTINCT ITEMS
    
    SQL = "SELECT COUNT(id) FROM Item"
    set rs = conn.execute(SQL)
    dim quantity()
    dim unitCost()
    redim quantity(rs(0))
    redim unitCost(rs(0))
    
    
    ' ***** GET THIS USER'S CART
    
    SQL = "SELECT item.id,title,price FROM Item,Cart"
    SQL = SQL & " WHERE item.id=cart.itemID and cart.custID=" & custID & " ORDER BY item.id"
    set rs = conn.execute(SQL)
    
    ' ***** SET UP VARIABLES:
    '    subtot = running subtotal of all items
    '    lastid allows us to know whether new item or not
    '    indItem tracks number of UNIQUE items in cart
        
    subtot = cCur(0)
    lastid = -1
    indItem = 0
    
    ' ***** MAKE SURE THERE ARE ITEMS IN CART
    
    if not rs.eof then
        Response.Write "<table border=1 bordercolor=#cccccc width=300 cellpadding=2 cellspacing=0>"
        do while not rs.eof
            id = rs(0)
            title = rs(1)
            subtot = cCur(subtot) + cCur(rs(2))
            price = formatCurrency(rs(2))
            
            if id = lastid then
            
                ' ***** NO NEED TO DRAW NEW ROW, JUST INCREASE QUANTITY OF THIS ITEM
                
                quantity(indItem) = quantity(indItem) + 1
                
            else

                ' ***** NEW ITEM = NEW ROW
                
                lastid = id
                indItem = indItem + 1
                quantity(indItem) = 1
                unitCost(indItem) = cCur(rs(2))
                str = str & "<tr valign=top><td>&nbsp;_Q_" & indItem & "_&nbsp;<b>&nbsp;<a href='#' onClick='showDetail(" & id & ");return false;'>" & title & "</a>"
                str = str & "</b></td><td align=right>" & price & "</td><td align=right><b>_S_" & indItem & "_</b><td align=right>&nbsp;<a href='#'"
                str = str & " onClick='removeItem(" & id & ");return false;'>Remover Item</a></td></tr>"
                
            end if
            
            rs.movenext
        loop
        
        ' ***** REPLACE PLACEHOLDER STRINGS WITH SUBTOTALS
        
        for i = 1 to indItem
            str = replace(str,"_Q_" & i & "_",quantity(i))
            str = replace(str,"_S_" & i & "_",formatCurrency(cCur(quantity(i)*unitCost(i))))
        next
        
        str = str & "<tr><td colspan=2 align=right>&nbsp;<br>Subtotal:</td><td align=right>&nbsp;<br><b>" & formatcurrency(subtot) & "</b></td>"
        str = str & "<td>&nbsp;</td></tr><tr><td colspan=5><a href='#' onClick='emptyCart();return false;'>Limpar Carrinho</a></td></tr></table>"
        Response.Write(str)
    else
        Response.Write("Seu Carrinho de Compras Está Vazio.<p>")
    end if
%></td>
  </tr>
</table>
<br />
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle"><!--#include file='foot_cart.asp'--></td>
  </tr>
</table>
</body>
</html>
E também tenho um formmail muito bem configurado, que envia todos os dados do cliente por email:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="STYLESHEET" type="text/css" href="../br/scripts/css_ms.css">
<form name="form1" method="get" action="formmail.asp">
  <table width="634" border="0" align="center">
    <tr bgcolor="#navyblue">
      <th colspan="2" align="center" class="Artista_Title">Cadastro de Pedidos</th>
    </tr>
    <tr>
      <td width="212" height="30" align="right" class="Conteudo"><font face="Verdana,Arial" size="-1">Nome*:</td>
      <td width="412"><font face="Verdana,Arial" size="-1">
      <input name="Nome" type="text" id="Nome" size="62" maxlength="100" /></td>
    </tr>
    <tr>
      <td height="30" align="right" class="Conteudo"><font face="Verdana,Arial" size="-1">Endere&ccedil;o*:</td>
      <td><font face="Verdana,Arial" size="-1">
      <input name="Endereco" type="text" id="Endereco" size="40" maxlength="100" />&nbsp;
      <span class="Conteudo">N&uacute;mero*:</span> 
      <label>
      <input name="Numero" type="text" id="Numero" size="4" maxlength="10" />
      </label></td>
    </tr>
    <tr>
      <td height="30" align="right" class="Conteudo"><font face="Verdana,Arial" size="-1">Complemento:</td>
      <td><font face="Verdana,Arial" size="-1">
          <input name="Complemento" type="text" id="Complemento" size="25" maxlength="60" /></td>
    </tr>
    <tr>
      <td height="30" align="right" class="Conteudo"><font face="Verdana,Arial" size="-1"> Cidade*:</td>
      <td><font face="Verdana,Arial" size="-1">
        <input name="Cidade" type="text" id="Cidade" size="25" maxlength="40" />
           <span class="Conteudo"></span><span class="Conteudo">Estado*:</span> 
        <input name="Estado" type="text" id="Estado" size="4" maxlength="4" /></td>
    </tr>
    <tr>
      <td height="30" align="right" class="Conteudo"><font face="Verdana,Arial" size="-1"> CEP*:</td>
      <td><font face="Verdana,Arial" size="-1">
          <input name="CEP" type="text" id="CEP" size="25" maxlength="30" /></td>
    </tr>
    <tr>
      <td height="30" align="right" class="Conteudo"><font face="Verdana,Arial" size="-1">Telefone*:</td>
      <td><font face="Verdana,Arial" size="-1">
          <input name="DDD" type="text" id="DDD" size="3" maxlength="3" />
       <input name="Telefone" type="text" id="Telefone" size="9" maxlength="9" /> </td>
    </tr>
    <tr>
      <td height="30" align="right" class="Conteudo"><font face="Verdana,Arial" size="-1">Celular:</td>
      <td><font face="Verdana,Arial" size="-1">
          <input name="DDDCEL" type="text" id="DDDCEL" size="3" maxlength="3" />
          <input name="Celular" type="text" id="Celular" size="9" maxlength="9" />      </td>
    </tr>
    
    <tr>
      <td height="30" align="right"><font size="-1" face="Verdana,Arial" class="Conteudo">Endere&ccedil;o de Email*:</font></td>
      <td><font face="Verdana,Arial" size="-1">
        <input name="email" size="30" maxlength="40" id="email" />
      </font> </td>
    </tr>
    <tr>
      <td height="30" align="right"><font size="-1" face="Verdana,Arial" class="Conteudo">Confirme seu Email*:</font></td>
      <td><font face="Verdana,Arial" size="-1">
        <input name="Confirmar_Email" id="Confirmar Email" size="30" maxlength="40" />
      </font> </td>
    </tr>
    <tr>
      <td height="30" align="right" class="Conteudo"><font face="Verdana,Arial" size="-1">Forma de Pagamento*:</td>
      <td><font face="Verdana,Arial" size="-1">
          <input name="Pagamento" id="Pagamento" type="radio" value="Boleto" checked="checked" /> 
          <span class="Conteudo">Boleto Banc&aacute;rio</span> 
        <input type="radio" name="Pagamento"  id="Pagamento" value="Transferencia" />
        <span class="Conteudo">Transf&ecirc;rencia Banc&aacute;ria</span></td>
    </tr>
    
    <tr>
      <td align="right"><font size="-1" face="Verdana,Arial" class="Conteudo">Coment&aacute;rio:</font></td>
      <td><p>
        <label>
        <textarea name="Comentario" cols="48" rows="5" id="Comentario"></textarea>
        </label>
      </p></td>
    </tr>
  </table>
  <div align="center"><br>
    <input type="submit" name="Submit" value="Enviar Pedido">
    <INPUT TYPE="reset" VALUE="Limpar">
    <br />
    <br>
    <input name="recipient" type="hidden" id="recipient" value="vendas@marciaspassapan.com.br">
    <input name="subject" type="hidden" id="subject" value="Pedido Web Site">
    <input name="redirect" type="hidden" id="redirect" value="http://www.marciaspassapan.com.br/br/contato/obrigado.html">
    <input name="required" type="hidden" id="required" value="Nome,Endereco,Numero,Cidade,Estado,CEP,DDD,Telefone,Email,Confirmar_Email,Pagamento">
  </div>
</form>
E esse forma tem o get formmail.asp, que é este aqui:
<%@ Language = vbscript%>
<%option explicit %>
<%server.scripttimeout = 600 %>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<%
'------------------------------------------- FORMMAIL V1.3 ------------------------------------------

'----------------------------------------------------------------------------------------------------
'copyright information
'----------------------------------------------------------------------------------------------------
'Copyright 2002: Sorted Sites http://www.sortedsites.com
'Authors Jonas Tornqvist, David Parkes and Karl Snares
'This script is Freeware, which means you are free to use and modify 
'the script for your own use.
'The only condition is this copyright header remain intact and you don't 
'try and sell this script for profit without first asking us. 
'And of course also ask Matt Wright who wrote the original perl version of Formmail.

'----------------------------------------------------------------------------------------------------
'license agreement - Important
'----------------------------------------------------------------------------------------------------
'By using this script you agree to indeminfy the developers - Sorted Sites of any loss
'or damages that may arise from its use or missue.
'This script is provided as is with all faults - no warranties and no guarantees.
'basically its free - use it at your own risk and cost.
'No warranties and no tech support - if you need help with this don't ask us!
'The documentation is provided as is with all the help we can offer.
'As we develop this script we shall post updates hopefully fix any bugs
'We are not obliged to release any future versions and we might not bother...
'By using this script you accept this license agreement!

'----------------------------------------------------------------------------------------------------
'documentation v1.3
'----------------------------------------------------------------------------------------------------

'####################################################################################################
'this is where the code starts for real
'####################################################################################################

'----------------------------------------------------------------------------------------------------
'declare variables
'----------------------------------------------------------------------------------------------------
Dim strFrom, strTo, strSubject, strBody
Dim objMessage, objConfig, strServer, intPort
Dim recipient, redirect, subject, nome, email, required, strEmail1, strEmail2
Dim referer, url, url_verified, icounter, query, iloop, query2, query3, i, agree, validation, error0, error0ok, strform

'############################## CONFIGURATION VARIABLES ####################################

'These are the only lines you will need to change
'----------------------------------------------------------------------------------------------------
strServer = "mail.marciaspassapan.com.br" 'set which smtp server will be used to send the email. enter ip address or domain name. eg: "xxx.xxx.xxx.xxx" or "smtp.your-domain.com"
intPort = 25 'set the smtp port to be used when sending mail (by default port 25 is used)
'Referrer's Array is defined here. Enter the valid domains which may use this script.
url = Array("www.marciaspassapan.com.br","marciaspassapan.com.br")'Set which urls that will be accepted. http://xxxxx/
    'Seperate multiple domains by commas 
    'eg: url= Array("www.your-domain.com","your-domain.com","www.my-domain.com")
    'computer names can be used instead of domains if this script is being run locally
    'eg: url = Array("computername")

'######################################### IMPORTANT NOTICE #########################################
'IMPORTANT: do not modify anything below this line unless you know what you are doing!!
'######################################### IMPORTANT NOTICE #########################################
    
'----------------------------------------------------------------------------------------------------
'information type and CDOSYS constants
'----------------------------------------------------------------------------------------------------
%>
<!--METADATA TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library" -->
<!--METADATA TYPE="typelib"
UUID="00000205-0000-0010-8000-00AA006D2EA4"
NAME="ADODB Type Library" -->
<%
'----------------------------------------------------------------------------------------------------
'retrieved default fields
'----------------------------------------------------------------------------------------------------
recipient = request("recipient")
redirect = request("redirect")
subject = request("subject")
email = request("email")
required = request("required") 
if required = "" then
    required = "recipient,subject,email,redirect"
else
    required = "recipient,subject,email,redirect," & required
end if

'----------------------------------------------------------------------------------------------------
'verify the referer
'----------------------------------------------------------------------------------------------------
referer = request.ServerVariables("HTTP_REFERER") 
referer = split(referer,"/")
url_verified = "no"
for icounter = Lbound(url) to Ubound(url) '
    if referer(2) = url(icounter) then
        url_verified = "yes"
    end if
next
if not url_verified = "yes" then 
    response.write("The url specified is invalid!")
    response.End
end if

'----------------------------------------------------------------------------------------------------
'verify the recipient(not tested)
'----------------------------------------------------------------------------------------------------
'trimed_referer = split(referer(2),".")'
'response.write recipient & "<br>" & referer(2) & "=" & trimed_referer(0) & "<br>"
'if trimed_referer(0) = "www" then
'    if InStr(1,recipient,trimed_referer(1),1) = 0 then
'        response.write "recipient don't match the referer"
'        response.end
'    end if
'else
'    if InStr(1,recipient,trimed_referer(0),1) = 0 then
'        response.write "recipient don't match the referer"
'        response.end
'    end if
'end if

'----------------------------------------------------------------------------------------------------
'retrieve form contents and create email fields
'---------------------------------------------------------------------------------------------------- 
query = Request.ServerVariables("QUERY_STRING") 
query = split(query,"&")
query3 = split(required,",")
    For iLoop = Lbound(query) to UBound(query)
        query2 = split(query(iloop),"=")
    
'----------------------------------------------------------------------------------------------------
'form validation, checks required fields are not null
'----------------------------------------------------------------------------------------------------
        for i = LBound(query3) to UBound(query3)
            if query3(i) = query2(0) then
                if query2(1) = "" then
                    response.write ("Clique no botão voltar do seu navegador, e preencha os seguintes dados corretamente: ") & query2(0)
                    response.end
                end if
            end if
            
            'if query2(0) = "agree" then
                'if query2(1) <> "on" or query2(1) = "" then
                '    response.write("You must agree to terms and conditions to enable Formmailv1.3 to execute!")
                'response.end
                'end if
            'end if
            
'----------------------------------------------------------------------------------------------------
'form validation, checks a valid email address has been specified
'----------------------------------------------------------------------------------------------------            
            if query2(0) = "email" then
                trim(query2(0))
                if len(query2(1))<8 then
                    response.Write("Você deve entrar com os seguintes dados válidos: ") & query2(0)
                    response.end
                end if
                if instr(query2(1),"@")=0 and instr(query2(1),".")=0 then
                    response.write query2(1)
                    response.Write("Clique no botão voltar do seu navegador, e preencha os seguintes dados corretamente: ") & query2(0)
                    response.end
                end if
                strEmail1 = split(query2(1),"@")
                if len(strEmail1(1))<3 then
                    response.Write("Clique no botão voltar do seu navegador, e preencha os seguintes dados corretamente: ") & query2(0)
                    response.end
                end if
                strEmail2 = split(strEmail1(1),".")
                if len(strEmail2(0))<3 then
                    response.Write("Clique no botão voltar do seu navegador, e preencha os seguintes dados corretamente: ") & query2(0)
                    response.end
                end if
                if len(strEmail2(1))<2 then
                    response.Write("Clique no botão voltar do seu navegador, e preencha os seguintes dados corretamente: ") & query2(0)
                    response.end
                end if
            end if

'----------------------------------------------------------------------------------------------------
'form validation, checks terms and conditions checkbox has been ticked
'----------------------------------------------------------------------------------------------------
            
        Next
        if not query2(0) = "recipient" and not query2(0) = "redirect" and not query2(0) = "subject" and not query2(0) = "Name" and not query2(0) = "email" and not query2(0) = "required" and not query2(0) = "agree" then
            strBody = strBody & vbnewline & vbnewline & query2(0) &": " & query2(1) 
        end if
    Next
if email = "" then
    email = "formmail@" & referer(2)
end if
'----------------------------------------------------------------------------------------------------
'replaces any special characters parsed through the query string
'----------------------------------------------------------------------------------------------------
strbody = replace(strbody, "+"," ")
strbody = replace(strbody, "%A1","¡")
strbody = replace(strbody, "%A3","£")
strbody = replace(strbody, "%A8","¨")
strbody = replace(strbody, "%AA","ª")
strbody = replace(strbody, "%AC","¬")
strbody = replace(strbody, "%B7","·")
strbody = replace(strbody, "%BA","º")
strbody = replace(strbody, "%BF","¿")
strbody = replace(strbody, "%21","!")
strbody = replace(strbody, "%23","#")
strbody = replace(strbody, "%24","$")
strbody = replace(strbody, "%25","%")
strbody = replace(strbody, "%26","&")
strbody = replace(strbody, "%27","'")
strbody = replace(strbody, "%28","(")
strbody = replace(strbody, "%29",")")
strbody = replace(strbody, "%2B","+")
strbody = replace(strbody, "%2C",",")
strbody = replace(strbody, "%2D","-")
strbody = replace(strbody, "%2E",".")
strbody = replace(strbody, "%2F","/")
strbody = replace(strbody, "%3A",":")
strbody = replace(strbody, "%3B",";")
strbody = replace(strbody, "%3C","<")
strbody = replace(strbody, "%3D","=")
strbody = replace(strbody, "%3E",">")
strbody = replace(strbody, "%3F","?")
strbody = replace(strbody, "%5B","[")
strbody = replace(strbody, "%5C","\")
strbody = replace(strbody, "%5D","]")
strbody = replace(strbody, "%5E","^")
strbody = replace(strbody, "%5F","_")
strbody = replace(strbody, "%60","`")
strbody = replace(strbody, "%7B","{")
strbody = replace(strbody, "%7C","|")
strbody = replace(strbody, "%7D","}")
strbody = replace(strbody, "%7E","~")
strbody = replace(strbody, "%C2","Â")
strbody = replace(strbody, "%B4","´")
strbody = replace(strbody, "%0D%0A%0D%0A","        ")
strbody = replace(strbody, "%B9","¹")
strbody = replace(strbody, "%B2","²")
strbody = replace(strbody, "%B3","³")
strbody = replace(strbody, "%A2","¢")
strbody = replace(strbody, "%DA","Ú")
strbody = replace(strbody, "%FA","ú")
strbody = replace(strbody, "%F9","ù")
strbody = replace(strbody, "%D9","Ù")
strbody = replace(strbody, "%ED","í")
strbody = replace(strbody, "%CD","Í")

strbody = replace(strbody, "%CC","Ì")
strbody = replace(strbody, "%EC","ì")
strbody = replace(strbody, "%F3","ó")
strbody = replace(strbody, "%D3","Ó")
strbody = replace(strbody, "%E9","é")
strbody = replace(strbody, "%C9","É")
strbody = replace(strbody, "%C8","È")
strbody = replace(strbody, "%E8","è")
strbody = replace(strbody, "%D4","Ô")
strbody = replace(strbody, "%F4","ô")

strbody = replace(strbody, "%CA","Ê")
strbody = replace(strbody, "%EA","ê")

strbody = replace(strbody, "%E3","ã")
strbody = replace(strbody, "%C3","Ã")
strbody = replace(strbody, "%E1","á")
strbody = replace(strbody, "%C1","Á")
strbody = replace(strbody, "%E0","à")
strbody = replace(strbody, "%C0","À")
strbody = replace(strbody, "%E7","ç")
strbody = replace(strbody, "%C7","Ç")
strbody = replace(strbody, "%E2","â")
strbody = replace(strbody, "%C7","Ç")
'----------------------------------------------------------------------------------------------------
'this creates the body of the mail message, the text in quotes can be modified accordingly 
'---------------------------------------------------------------------------------------------------
strBody = "Enviaram um Contato pelo Site " & referer(2)  & vbnewline & vbnewline & "Email: " & email & strBody
'----------------------------------------------------------------------------------------------------
'checks if a smtp port has been specified, if not it uses the default port 25
'----------------------------------------------------------------------------------------------------
if intport <> 25 then
    intport = intport
else
    intport = 25
end if

'----------------------------------------------------------------------------------------------------
'send the mail message
'----------------------------------------------------------------------------------------------------    
set objMessage = CreateObject("CDO.Message")
objMessage.To = recipient
objMessage.From = email
objMessage.Subject = subject
objMessage.Sender = email
objMessage.Textbody = strBody

'----------------------------------------------------------------------------------------------------
'cdosys configuration setup
'----------------------------------------------------------------------------------------------------
set objConfig = CreateObject("CDO.Configuration")
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer) = strServer
objConfig.Fields(cdoSMTPServerPort) = intPort
objConfig.Fields(cdoSMTPAuthenticate) = cdoAnonymous
objConfig.Fields.Update
set objMessage.Configuration = objConfig

'----------------------------------------------------------------------------------------------------
'define error handling procedures
'----------------------------------------------------------------------------------------------------
On Error Resume Next
    objMessage.Send
If Err.Number = 0 then
    response.write("Formmail v1.3 processed all operations successfully!")
else
    response.write("Formmail v1.3 detected the following errors:")& "<br>"
    response.write("error no.: ")&err.number & "<br>"
    response.write("description: ")&err.description & "<br>"
    response.end
End If
On Error Goto 0
    
'----------------------------------------------------------------------------------------------------
'send them to the page specified
'----------------------------------------------------------------------------------------------------
Response.Redirect redirect

'####################################################################################################
'This is where the code ends
'####################################################################################################
%>
<!-- That's All Folks -->
<!-- Happy Surfing -->
<!-- Credits -->
<!-- David Parkes - Project Planning -->
<!-- Jonas Tornqvist - Lead Programmer version 1-->
<!-- Karl Snares - Lead Programmer version 1.2 & 1.3
<!-- Matt Wright - Original Formmail CGI Developer -->

O problema é que o formmail só envia os dados dentro das Forms que o cliente digita, porém eu gostaria de puxar os dados do carrinho de compra para o form, para que venha além dos dados do cliente, que venha junto os produtos que ele pediu.

Na teoria seria assim:

No form.asp (formulario de email) eu puxaria as informações do cart.asp (que é a pagina do carrinho de compras). Teria como eu fazer esse procedimento??

valeu galera.

PS: Sei que sou novato, e que estou pegando diversos códigos prontos na internet, mas em asp eu sou muito novato, e estou estudando muito, e com esses códigos prontos eu aprendi já muita coisa e consegui remodelar ele de uma forma para meu uso ;) . De algum lugar eu tenho que começar né???? ;)

Editado por Caio Rebello
Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

não olhei seu codigo ... vo te da a ideia...

veja que onde o carrinhpo escreve o que tem nele,...

ai é o seguinte em vez de escreve na tela tu vai preenchendo a variavel..

car="<table><tr><td>"
car=car&"produto</td><td>"&var_roduto&"</td></tr>"
car=car&"</table>"

ai essa variavel car é usada no corpo da msg enviando a tabela html inteira...

Link para o comentário
Compartilhar em outros sites

  • 0

Bareta, obrigado pela ajuda.

Eu andei estudando o código e fazendo alguns testes, o problema esta no formmail, quando envio o formulario, o formmail.asp (que é o codigo cdosys) so envias as tags de form.

Teria como eu acrescentar no formmail.asp algum código que acresente no email a página cart.asp? Como eu faria isso?

Aqui esta o código da formmail.asp

PS=eu tentei adicionar um código cart.asp, mas não deu certo.

<%@ Language = vbscript%>
<%option explicit %>
<%server.scripttimeout = 600 %>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<%
'------------------------------------------- FORMMAIL V1.3 ------------------------------------------

'----------------------------------------------------------------------------------------------------
'copyright information
'----------------------------------------------------------------------------------------------------
'Copyright 2002: Sorted Sites http://www.sortedsites.com
'Authors Jonas Tornqvist, David Parkes and Karl Snares
'This script is Freeware, which means you are free to use and modify 
'the script for your own use.
'The only condition is this copyright header remain intact and you don't 
'try and sell this script for profit without first asking us. 
'And of course also ask Matt Wright who wrote the original perl version of Formmail.

'----------------------------------------------------------------------------------------------------
'license agreement - Important
'----------------------------------------------------------------------------------------------------
'By using this script you agree to indeminfy the developers - Sorted Sites of any loss
'or damages that may arise from its use or missue.
'This script is provided as is with all faults - no warranties and no guarantees.
'basically its free - use it at your own risk and cost.
'No warranties and no tech support - if you need help with this don't ask us!
'The documentation is provided as is with all the help we can offer.
'As we develop this script we shall post updates hopefully fix any bugs
'We are not obliged to release any future versions and we might not bother...
'By using this script you accept this license agreement!

'----------------------------------------------------------------------------------------------------
'documentation v1.3
'----------------------------------------------------------------------------------------------------

'####################################################################################################
'this is where the code starts for real
'####################################################################################################

'----------------------------------------------------------------------------------------------------
'declare variables
'----------------------------------------------------------------------------------------------------
Dim strFrom, strTo, strSubject, strBody
Dim objMessage, objConfig, strServer, intPort
Dim recipient, redirect, subject, nome, email, required, strEmail1, strEmail2
Dim referer, url, url_verified, icounter, query, iloop, query2, query3, i, agree, validation, error0, error0ok, strform, cart

'############################## CONFIGURATION VARIABLES ####################################

'These are the only lines you will need to change
'----------------------------------------------------------------------------------------------------
strServer = "mail.marciaspassapan.com.br" 'set which smtp server will be used to send the email. enter ip address or domain name. eg: "xxx.xxx.xxx.xxx" or "smtp.your-domain.com"
intPort = 25 'set the smtp port to be used when sending mail (by default port 25 is used)
'Referrer's Array is defined here. Enter the valid domains which may use this script.
url = Array("www.marciaspassapan.com.br","marciaspassapan.com.br")'Set which urls that will be accepted. http://xxxxx/
    'Seperate multiple domains by commas 
    'eg: url= Array("www.your-domain.com","your-domain.com","www.my-domain.com")
    'computer names can be used instead of domains if this script is being run locally
    'eg: url = Array("computername")

'######################################### IMPORTANT NOTICE #########################################
'IMPORTANT: do not modify anything below this line unless you know what you are doing!!
'######################################### IMPORTANT NOTICE #########################################
    
'----------------------------------------------------------------------------------------------------
'information type and CDOSYS constants
'----------------------------------------------------------------------------------------------------
%>
<!--METADATA TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library" -->
<!--METADATA TYPE="typelib"
UUID="00000205-0000-0010-8000-00AA006D2EA4"
NAME="ADODB Type Library" -->
<%
'----------------------------------------------------------------------------------------------------
'retrieved default fields
'----------------------------------------------------------------------------------------------------
cart = ("cart.asp")
recipient = request("recipient")
cart = request("cart.asp")
redirect = request("redirect")
subject = request("subject")
email = request("email")
required = request("required") 
if required = "" then
    required = "recipient,subject,email,redirect"
else
    required = "recipient,cart,subject,email,redirect," & required
end if

'----------------------------------------------------------------------------------------------------
'verify the referer
'----------------------------------------------------------------------------------------------------
referer = request.ServerVariables("HTTP_REFERER") 
referer = split(referer,"/")
url_verified = "no"
for icounter = Lbound(url) to Ubound(url) '
    if referer(2) = url(icounter) then
        url_verified = "yes"
    end if
next
if not url_verified = "yes" then 
    response.write("The url specified is invalid!")
    response.End
end if

'----------------------------------------------------------------------------------------------------
'verify the recipient(not tested)
'----------------------------------------------------------------------------------------------------
'trimed_referer = split(referer(2),".")'
'response.write recipient & "<br>" & referer(2) & "=" & trimed_referer(0) & "<br>"
'if trimed_referer(0) = "www" then
'    if InStr(1,recipient,trimed_referer(1),1) = 0 then
'        response.write "recipient don't match the referer"
'        response.end
'    end if
'else
'    if InStr(1,recipient,trimed_referer(0),1) = 0 then
'        response.write "recipient don't match the referer"
'        response.end
'    end if
'end if

'----------------------------------------------------------------------------------------------------
'retrieve form contents and create email fields
'---------------------------------------------------------------------------------------------------- 
query = Request.ServerVariables("QUERY_STRING") 
query = split(query,"&")
query3 = split(required,",")
    For iLoop = Lbound(query) to UBound(query)
        query2 = split(query(iloop),"=")
    
'----------------------------------------------------------------------------------------------------
'form validation, checks required fields are not null
'----------------------------------------------------------------------------------------------------
        for i = LBound(query3) to UBound(query3)
            if query3(i) = query2(0) then
                if query2(1) = "" then
                    response.write ("Clique no botão voltar do seu navegador, e preencha os seguintes dados corretamente: ") & query2(0)
                    response.end
                end if
            end if
            
            'if query2(0) = "agree" then
                'if query2(1) <> "on" or query2(1) = "" then
                '    response.write("You must agree to terms and conditions to enable Formmailv1.3 to execute!")
                'response.end
                'end if
            'end if
            
'----------------------------------------------------------------------------------------------------
'form validation, checks a valid email address has been specified
'----------------------------------------------------------------------------------------------------            
            if query2(0) = "email" then
                trim(query2(0))
                if len(query2(1))<8 then
                    response.Write("Você deve entrar com os seguintes dados válidos: ") & query2(0)
                    response.end
                end if
                if instr(query2(1),"@")=0 and instr(query2(1),".")=0 then
                    response.write query2(1)
                    response.Write("Clique no botão voltar do seu navegador, e preencha os seguintes dados corretamente: ") & query2(0)
                    response.end
                end if
                strEmail1 = split(query2(1),"@")
                if len(strEmail1(1))<3 then
                    response.Write("Clique no botão voltar do seu navegador, e preencha os seguintes dados corretamente: ") & query2(0)
                    response.end
                end if
                strEmail2 = split(strEmail1(1),".")
                if len(strEmail2(0))<3 then
                    response.Write("Clique no botão voltar do seu navegador, e preencha os seguintes dados corretamente: ") & query2(0)
                    response.end
                end if
                if len(strEmail2(1))<2 then
                    response.Write("Clique no botão voltar do seu navegador, e preencha os seguintes dados corretamente: ") & query2(0)
                    response.end
                end if
            end if

'----------------------------------------------------------------------------------------------------
'form validation, checks terms and conditions checkbox has been ticked
'----------------------------------------------------------------------------------------------------
            
        Next
        if not query2(0) = "recipient" and not query2(0) = "redirect" and not query2(0) = "subject" and not query2(0) = "Name" and not query2(0) = "email" and not query2(0) = "required" and not query2(0) = "agree" then
            strBody = strBody & vbnewline & vbnewline & query2(0) &": " & query2(1) 
        end if
    Next
if email = "" then
    email = "formmail@" & referer(2)
end if
'----------------------------------------------------------------------------------------------------
'replaces any special characters parsed through the query string
'----------------------------------------------------------------------------------------------------
strbody = replace(strbody, "+"," ")
strbody = replace(strbody, "%A1","¡")
strbody = replace(strbody, "%A3","£")
strbody = replace(strbody, "%A8","¨")
strbody = replace(strbody, "%AA","ª")
strbody = replace(strbody, "%AC","¬")
strbody = replace(strbody, "%B7","·")
strbody = replace(strbody, "%BA","º")
strbody = replace(strbody, "%BF","¿")
strbody = replace(strbody, "%21","!")
strbody = replace(strbody, "%23","#")
strbody = replace(strbody, "%24","$")
strbody = replace(strbody, "%25","%")
strbody = replace(strbody, "%26","&")
strbody = replace(strbody, "%27","'")
strbody = replace(strbody, "%28","(")
strbody = replace(strbody, "%29",")")
strbody = replace(strbody, "%2B","+")
strbody = replace(strbody, "%2C",",")
strbody = replace(strbody, "%2D","-")
strbody = replace(strbody, "%2E",".")
strbody = replace(strbody, "%2F","/")
strbody = replace(strbody, "%3A",":")
strbody = replace(strbody, "%3B",";")
strbody = replace(strbody, "%3C","<")
strbody = replace(strbody, "%3D","=")
strbody = replace(strbody, "%3E",">")
strbody = replace(strbody, "%3F","?")
strbody = replace(strbody, "%5B","[")
strbody = replace(strbody, "%5C","\")
strbody = replace(strbody, "%5D","]")
strbody = replace(strbody, "%5E","^")
strbody = replace(strbody, "%5F","_")
strbody = replace(strbody, "%60","`")
strbody = replace(strbody, "%7B","{")
strbody = replace(strbody, "%7C","|")
strbody = replace(strbody, "%7D","}")
strbody = replace(strbody, "%7E","~")
strbody = replace(strbody, "%C2","Â")
strbody = replace(strbody, "%B4","´")
strbody = replace(strbody, "%0D%0A%0D%0A","        ")
strbody = replace(strbody, "%B9","¹")
strbody = replace(strbody, "%B2","²")
strbody = replace(strbody, "%B3","³")
strbody = replace(strbody, "%A2","¢")
strbody = replace(strbody, "%DA","Ú")
strbody = replace(strbody, "%FA","ú")
strbody = replace(strbody, "%F9","ù")
strbody = replace(strbody, "%D9","Ù")
strbody = replace(strbody, "%ED","í")
strbody = replace(strbody, "%CD","Í")

strbody = replace(strbody, "%CC","Ì")
strbody = replace(strbody, "%EC","ì")
strbody = replace(strbody, "%F3","ó")
strbody = replace(strbody, "%D3","Ó")
strbody = replace(strbody, "%E9","é")
strbody = replace(strbody, "%C9","É")
strbody = replace(strbody, "%C8","È")
strbody = replace(strbody, "%E8","è")
strbody = replace(strbody, "%D4","Ô")
strbody = replace(strbody, "%F4","ô")

strbody = replace(strbody, "%CA","Ê")
strbody = replace(strbody, "%EA","ê")

strbody = replace(strbody, "%E3","ã")
strbody = replace(strbody, "%C3","Ã")
strbody = replace(strbody, "%E1","á")
strbody = replace(strbody, "%C1","Á")
strbody = replace(strbody, "%E0","à")
strbody = replace(strbody, "%C0","À")
strbody = replace(strbody, "%E7","ç")
strbody = replace(strbody, "%C7","Ç")
strbody = replace(strbody, "%E2","â")
strbody = replace(strbody, "%C7","Ç")
'----------------------------------------------------------------------------------------------------
'this creates the body of the mail message, the text in quotes can be modified accordingly 
'---------------------------------------------------------------------------------------------------
strBody = "Enviaram um Contato pelo Site " & referer(2)  & vbnewline & vbnewline & "Email: " & email & cart & strBody 
'----------------------------------------------------------------------------------------------------
'checks if a smtp port has been specified, if not it uses the default port 25
'----------------------------------------------------------------------------------------------------
if intport <> 25 then
    intport = intport
else
    intport = 25
end if

'----------------------------------------------------------------------------------------------------
'send the mail message
'----------------------------------------------------------------------------------------------------    
set objMessage = CreateObject("CDO.Message")
objMessage.To = recipient
objMessage.From = email
objMessage.Subject = subject
objMessage.Sender = email
objMessage.Textbody = strBody

'----------------------------------------------------------------------------------------------------
'cdosys configuration setup
'----------------------------------------------------------------------------------------------------
set objConfig = CreateObject("CDO.Configuration")
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer) = strServer
objConfig.Fields(cdoSMTPServerPort) = intPort
objConfig.Fields(cdoSMTPAuthenticate) = cdoAnonymous
objConfig.Fields.Update
set objMessage.Configuration = objConfig

'----------------------------------------------------------------------------------------------------
'define error handling procedures
'----------------------------------------------------------------------------------------------------
On Error Resume Next
    objMessage.Send
If Err.Number = 0 then
    response.write("Formmail v1.3 processed all operations successfully!")
else
    response.write("Formmail v1.3 detected the following errors:")& "<br>"
    response.write("error no.: ")&err.number & "<br>"
    response.write("description: ")&err.description & "<br>"
    response.end
End If
On Error Goto 0
    
'----------------------------------------------------------------------------------------------------
'send them to the page specified
'----------------------------------------------------------------------------------------------------
Response.Redirect redirect

Obrigado ai pela ajuda..

ABS.

Editado por Caio Rebello
Link para o comentário
Compartilhar em outros sites

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.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...