Visualizzazione dei risultati da 1 a 10 su 10

Discussione: invio email

  1. #1

    invio email

    Ho questo problema:

    devo inviare un'email usando cdo.message
    Se nel body inserisco direttamente una stringa l'email viene inviata, se invece assegno una variabile stringa non viene inviata.
    A qualcuno è già capitato questo problema.

    Di seguito il codice funzionante:

    Set ml = Server.CreateObject("CDO.Message")
    ml.From = "info@aquest.it"
    ml.To = "gurru@aquest.it"
    ml.Subject = "Richiesta d'acquisto"
    ml.TextBody = "prova di un invio di una email"
    ml.Send
    Set ml = Nothing

    Qui il codice che non funzia:

    TestoEmail = "Cognome: " & Request.Form("Cognome") & Chr(10)
    TestoEmail = TestoEmail & "Nome: " & Request.Form("Nome") & Chr(10)
    TestoEmail = TestoEmail & "Indirizzo: " & Request.Form("Indirizzo") & Chr(10)
    TestoEmail = TestoEmail & "Cap: " & Request.Form("Cap") & Chr(10)
    TestoEmail = TestoEmail & "Città: " & Request.Form("Citta") & Chr(10)
    TestoEmail = TestoEmail & "Provincia: " & Request.Form("provincia") & Chr(10)
    TestoEmail = TestoEmail & "Nazione: " & Request.Form("Nazione") & Chr(10)
    TestoEmail = TestoEmail & "Telefono: " & Request.Form("Telefono") & Chr(10)
    TestoEmail = TestoEmail & "Fax: " & Request.Form("Fax") & Chr(10)
    TestoEmail = TestoEmail & "Email: " & Request.Form("Email") & Chr(10)
    Set ml = Server.CreateObject("CDO.Message")
    ml.From = "info@aquest.it"
    ml.To = "gurru@aquest.it"
    ml.Subject = "Richiesta d'acquisto"
    ml.TextBody = TestoEmail
    ml.Send
    Set ml = Nothing

    Grazie
    Ciao a tutti

  2. #2
    fai un test stampato Testoemail
    e subito dopo metti response.end vedi cosa contiene Testoemail

  3. #3
    response.write(TestoEmail) mi da la concatenazione dei valori passati da form.

    Il response.End() non mi da nulla

  4. #4
    posta il contenuto, è lì che c'è qualche carattere non valido

  5. #5
    Utente di HTML.it
    Registrato dal
    Dec 2003
    Messaggi
    102

    Forse

    Forse quando come ultima stringa del TestoEmail
    devi mettere
    TestoEmail = TestoEmail
    Prova

  6. #6
    il contenuto di TestoEmail è la concatenazione di valori inseriti da form senza nessun carattere particolare.
    Non è per caso che crea problemi il Chr(10)?

  7. #7
    Utente di HTML.it
    Registrato dal
    Dec 2003
    Messaggi
    102

    Si ma ...

    SI mi è ben chiaro la concatenazione
    Hai provato ad aggiungere quella stringa al fondo?
    Il alternativa puoi provare a sostituire il carattere Chr(10) con un a capo "vbcrlf" o "
    "

  8. #8
    ora provo a sostituire chr(10) con vbCrLf e vediamo se risolvo

  9. #9
    Utente di HTML.it
    Registrato dal
    Dec 2003
    Messaggi
    102

    Eccoti un esempio

    bodyTxt = "<span>You have just received an email from security.
    Please click here.</span>"

    emailHere = "iola@eecom.com"
    Set objSendMail = CreateObject("CDO.Message")
    objSendMail.Subject = "Your Certificate"
    objSendMail.MailFormat = 0
    objSendMail.BodyFormat = 0
    objSendMail.From = "iola"
    objSendMail.To = emailHere
    objSendMail.TextBody = bodyTxt
    objSendMail.send

    Imposta i
    ed inoltre imposta inserisci il MailFormat ed il BodyFormat
    Fammi sapere

  10. #10
    ok grazie

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.