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

    MAlL FORMAT : HTML + TXT

    Ciao a tutti, ho un problema di formattazione della mail che viene inviata come riepilogo dell'ordine effettuato.
    l'utente sceglie gli articoli, va nel carrello, compila il form e poi clicca su invia l'ordine.
    ora la pagina send.asp si occupa della creazione della mail e della spedizione.

    cosi' viene creato l'ordine con il contenuto del carrello:

    codice:
    i = session("items")
    	       		mailText = mailText & chr(13) & chr(10) & chr(13) & chr(10)
    			mailText = mailText & orderPerson & chr(13) & chr(10) 
    			mailtext = mailText & "----------------------------------------" & chr(13) & chr(10)
    	for t = o to i
    		if (warenkorb(t,0)) <> "" then
    			gesamt_artikel =  + warenkorb(t,0) * warenkorb(t,2)
    			gesamt = FormatNumber(gesamt + gesamt_artikel,2,,-2)
     		        mailText = mailText & l_list1 & " : " & warenkorb(t,0) & chr(13)& chr(10)
    			mailText = mailText & l_list2 & " : " & warenkorb(t,3) & chr(13)& chr(10)
    			mailText = mailText & l_list3 & " : " & warenkorb(t,4) & chr(13)& chr(10)
    			mailText = mailText & l_list4 & " : " & FormatNumber(warenkorb(t,2),2,,-2) & chr(13)& chr(10)
    			mailtext = mailtext & l_list5 & " : " & FormatNumber(gesamt_artikel,2,,-2)& chr(13) & chr(10)
    			mailtext = mailText & "----------------------------------------" & chr(13) & chr(10)
    		end if
    	next
    	mailtext = mailText & "========================================" & chr(13) & chr(10)
    	mailtext = mailtext & l_list6 & " : " & FormatNumber(gesamt,2,,-2)
    cosi' creo la mail:

    codice:
    'create an instance of the CDONTS object 
    Set Mailer = CreateObject("CDONTS.NewMail")
    
            html = html & "<html><head>"
     	html = html & "<title>Nextshop ordine online</title>"
     	html = html & "</head>"
     	html = html & "<body bgcolor=""#FFFFFF"">"
     	html = html &"<center>
    "
     	html = html & "[img][/img]"
            html = html &"</center>
    "
            html = html &"<left>"
            html = html & mailText 
            html = html &"</left>
    "
            html = html &"<center>
    
    
    "
            html = html & "<a href=""http://www.nextart.it/shop"">"
            html = html & "Torna a visitarci</a>
    
    "
     	html = html & "presto
    
    "
    	html = html & "</center>"
     	html = html & "</body>"
     	html = html & "</html>"
    
         ' 0 = html  1 = ascii
        Mailer.MailFormat = 0
        Mailer.BodyFormat = 0 
        Mailer.From = mail_sender
        Mailer.To = checkField(request.form("m_mailadress"))
        Mailer.Bcc = mail_empfaenger
        Mailer.Subject = mail_subject
        Mailer.Body = html
        Mailer.Send
    Set Mailer= Nothing	end if
    
    end if
    il mio problema e' che formattando la mail in HTML, (vedi Mailer.MailFormat = 0
    Mailer.BodyFormat = 0) , la parte degli articoli ordinati non viene formattata correttamente
    non tenendo conto dei & chr(13)& chr(10) che dovrebebro dire vai a capo.

    cosi':
    Ordine online effettuato presso NEXT_SHOP di ........ Nome: q Città: q Via: q Stato: q Telefono: q Indirizzo E-Mail: domini@nextart.it Commenti: 11111111111 ---------------------------------------- Quantità : 1 Codice : 00004 Articolo : NEXT_ PHOTO Prezzo unitario : 0,00 Prezzo : 0,00 ---------------------------------------- =Totale: : 0,00

    al contrario se imposto Mailer.MailFormat = 1 Mailer.BodyFormat = 1 la formattazione dell'ordine e' corretta, ma ovviamente non posso inserire il logo o altri elementi html.
    come avere la mail in formato html e l'ordine formatatto correttamente?

    grazie....
    -Nextart.it Graphic Solutions

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Per la formattazione in HTML al posto di & chr(13)& chr(10) che oviament eper il tuo HTML non usi mai, devi usare


    Roby

  3. #3
    grazie per lòa risposta immaginavo fosse cosi' , ma come devo inserirlo?

    codice:
    i = session("items")
    	       		mailText = mailText "
    " 			mailText = mailText & orderPerson & chr(13) & chr(10) 
    			mailtext .....

    cosi' mi da errore interno del server......
    non so, va senza apici?

    l'errore e' questo:
    Microsoft VBScript compilation error '800a03ea'

    Syntax error

    /shop/send.asp, line 129

    mailText = mailText &

    ----------------------^

    -Nextart.it Graphic Solutions

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
     		        mailText = mailText & l_list1 & " : " & warenkorb(t,0) & "
    "
    Roby

  5. #5
    grazie, roby, ora e' perfetto.....

    -Nextart.it Graphic Solutions

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 © 2026 vBulletin Solutions, Inc. All rights reserved.