Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    inviare il report del carrello via mail

    Spero che qualcuno possa darmi una mano, sto impazzendo da diversi giorni e non ne vengo a capo:

    al termine della compilazione dell'ordine da carrello, devo inviare il resoconto via email al compratore e all'amministratore; le ho provate tutte, il problema e che mi scrive solo la prima riga dell'ordine provo ad allegarvi il codice nella speranza che qualcuno ci capisca più di me.

    premetto: il db è sql, è perfettamente funzionante e le tabelle sono piene:

    intestazione = "<p style='text-align:center'><span style='font-size:9.0pt;font-family:Verdana'>Gent.mo Sig. </span><span class=Stile1>"&(cliente.Fields.Item("Descrizione") .Value)&"</span>"&"
    "&"<span style='font-family:Verdana'>di seguito le riportiamo i dati relativi all' ordine da lei effettuato</span></p>"
    corpoMessaggio = "<hr><table width=620 border=0 align=center cellpadding=0 cellspacing=0><tr><td valign=top><table width=100% border=0 cellspacing=0 cellpadding=2><tr><td width=100% align=left class=title3><table width=100% border=0 cellspacing=1 cellpadding=3><tr><td width=25% align=right>ordine n. </td><td width=25% align=left>"&(rs3.Fields.Item("Id_DoTes").Value)&" </td><td width=25% align=right>del</td><td width=25% align=left>"&(rs3.Fields.Item("DataDoc").Value)&"</td></tr></table></td></tr><tr><td valign=top><table width=100% border=0 cellspacing=1 cellpadding=3><tr class=title3><td width=25% align=right class=title2>effettuato da </td><td colspan=3 class=title2><span class=title2>"& UCase((rs2.Fields.Item("Descrizione").Value))&"</span></td></tr><tr class=title2><td width=25% align=right class=title2>P.IVA</td><td width=25% class=title2>"&(rs2.Fields.Item("PartitaIva").Valu e)&"</td><td width=25% align=right bgcolor=#FFFFFF>COD.FISC</td><td width=25% class=title2>"&(rs2.Fields.Item("CodiceFiscale").V alue)&"</td></tr><tr class=title2><td width=25% align=right class=title2>INDIRIZZO</td><td width=25% class=title2>"&(rs2.Fields.Item("Indirizzo").Value )&"</td><td width=25% align=right bgcolor=#FFFFFF>CITTA</td><td width=25% class=title2>"&(rs2.Fields.Item("Localita").Value) &"</td></tr><tr class=title2><td width=25% align=right class=title2>CAP</td><td width=25% class=title2>"&(rs2.Fields.Item("Cap").Value)&"</td><td width=25% align=right bgcolor=#FFFFFF>TELEFONO</td><td width=25% class=title2>"&(rs2.Fields.Item("Telefono").Value) &"</td> </tr><tr class=title2><td width=25% align=right class=title2>FAX</td><td width=25% class=title2>"&(rs2.Fields.Item("Fax").Value)&"</td><td width=25% align=right bgcolor=#FFFFFF>CELLULARE</td><td width=25% class=title2>"&(rs2.Fields.Item("Cellulare").Value )&"</td></tr><tr class=title2> <td width=25% align=right class=title2>EMAIL</td><td width=25% class=title2>"&(rs2.Fields.Item("Email").Value)&"</td><td width=25% align=right bgcolor=#FFFFFF>WEBSITE</td><td width=25% class=title2>"&(rs2.Fields.Item("URL").Value)&"</td></tr></table></td></tr><tr><td><hr /></td></tr><tr> <td bgcolor=#FFFFFF class=title3>Dettaglio Prodotti Ordinati </td></tr><tr><td><table width=100% border=0 cellpadding=2 cellspacing=2><tr bgcolor=#0000CC class=title1><td align=left width=50 class=title3B>codice</td><td align=left width=50% class=title3B>descrizione</td><td align=left width=10% class=title3B>prezzo</td><td align=left width=10% class=title3B>quantita</span><td align=right width=15% class=title3B>totale parziale</td></tr>"
    do while not(rs.eof)
    prodotti="<table width=620 border=0 cellpadding=2 cellspacing=2><tr bgcolor=#0000CC class=title1><td width=10% align=left bgcolor=#FF6600 class=title3B ><table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=#FF6600 class=title3B ><tr><td width=50 align=left bgcolor=#FF6600 class=title3B >"&(rs.Fields.Item("Cd_AR").Value)&"</td></tr></table></td><td width=50% align=left bgcolor=#FF6600 class=title3B >"&(rs.Fields.Item("Descrizione").Value)&"</td><td width=10% align=left bgcolor=#FF6600 class=title3B >"&(FormatCurrency(rs("Prezzo"), 2, -2, -2, -2))&"</td><td width=10% align=left bgcolor=#FF6600 class=title3B >"&(rs.Fields.Item("Qta").Value)&"</td><td width=15% align=right bgcolor=#FF6600 class=title3B >&euro;. "&(FormatCurrency(rs("Prezzo"), 2, -2, -2, -2)) * (FormatNumber((rs.Fields.Item("Qta").Value), -1, -2, -2, -2))&"</td></tr></table></td></tr></table>"&_
    rs.movenext
    loop
    %>
    <%mes = ""
    IsSuccess = false

    sTo = "test2@idsolution.it" ' email del mittente
    sFROM = "test@idsolution.it" ' email del destinatario
    sCC = rs2.Fields.Item("Email").Value
    sSubject = "ORDINE DEL "&Now()&" di: "&(rs2.Fields.Item("Descrizione").Value)&"("&(rs2. Fields.Item("Localita").Value)&")"
    sMailServer = "127.0.0.1"
    sBody = intestazione&corpoMessaggio&prodotti&saluti&firma& privacy

    'creazione degli oggetti necessari
    Set objMail = Server.CreateObject("CDO.Message")
    Set objConf = Server.CreateObject("CDO.Configuration")
    Set objFields = objConf.Fields

    With objFields
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sMailServer
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    .Update
    End With

    With objMail
    Set .Configuration = objConf
    .FROM = sFROM
    .To = sTo
    .CC = sCC
    .Subject = sSubject
    .HTMLBody = sBody
    End With

    Err.Clear
    on error resume next

    'objMail.Send
    if len(Err.Description) = 0 then
    mes = " Messaggio inviato a " + sTo
    mes = mes + " INVIO COMPLETATO CON SUCCESSO!"
    IsSuccess = true
    else
    mes = " " + Err.Description + " INVIO FALLITO!"
    end if
    Set objFields = Nothing
    Set objConf = Nothing
    Set objMail = Nothing
    response.Write("To: "&sTo)&"
    "
    response.Write("From: "&sFrom)&"
    "
    response.Write("CC: "&sCC)&"
    "
    response.Write("Subject: "&sSubject)&"
    "
    response.Write(sBody)
    'if IsSuccess then
    ' Response.Write "<div class='testRelults' id='testSuccessful'><span class='testResult'>INVIO CORRETTO:</span>
    to:"&sTo& "
    cc:" & sCC & html & "</div>"
    'else
    ' Response.Write "<div class='testRelults' id='testFailed'><span class='testResult'>INVIO FALLITO:</span>" & html & "</div>"
    'end if

    %>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    prodotti = ""
    do while not(rs.eof)
    prodotti=prodotti &"<table width=620 border=0 cellpadding=2 cellspacing=2><tr bgcolor=#0000CC class=title1><td width=10% align=left bgcolor=#FF6600 class=title3B ><table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=#FF6600 class=title3B ><tr><td width=50 align=left bgcolor=#FF6600 class=title3B >"&(rs.Fields.Item("Cd_AR").Value)&"</td></tr></table></td><td width=50% align=left bgcolor=#FF6600 class=title3B >"&(rs.Fields.Item("Descrizione").Value)&"</td><td width=10% align=left bgcolor=#FF6600 class=title3B >"&(FormatCurrency(rs("Prezzo"), 2, -2, -2, -2))&"</td><td width=10% align=left bgcolor=#FF6600 class=title3B >"&(rs.Fields.Item("Qta").Value)&"</td><td width=15% align=right bgcolor=#FF6600 class=title3B >€. "&(FormatCurrency(rs("Prezzo"), 2, -2, -2, -2)) * (FormatNumber((rs.Fields.Item("Qta").Value), -1, -2, -2, -2))&"</td></tr></table></td></tr></table>"
    rs.movenext
    Roby

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.