Visualizzazione dei risultati da 1 a 7 su 7

Discussione: Invio email()

  1. #1

    Invio email()

    Non riesco a far funzionare l'invio dell'email dal mio sito,
    questo e il codice che uso:
    <?php

    // L'INDIRIZZO DEL DESTINATARIO DELLA MAIL
    $to = "tecnicorocco@tiscali.it";

    // IL SOGGETTO DELLA MAIL
    $subject = "Informazione dal sito";


    // COSTRUIAMO IL CORPO DEL MESSAGGIO
    $body = "Contenuto del modulo:\n\n";
    $body .= "Nome: " . trim(stripslashes($_POST["Nome"])) . "\n";
    $body .= "Età: " . trim(stripslashes($_POST["Anni"])) . "\n";
    $body .= "Città: " . trim(stripslashes($_POST["City"])) . "\n";
    $body .= "Indirizzo: " . trim(stripslashes($_POST["Indirizzo"])) . "\n";
    $body .= "Note: " . trim(stripslashes($_POST["Note"])) . "\n";

    // INTESTAZIONI SUPPLEMENTARI
    $headers = "From: Modulo utenti<modulo@sito.it>";

    // INVIO DELLA MAIL
    if(@mail($to, $subject, $body, $headers)) { // SE L'INOLTRO E' ANDATO A BUON FINE...

    echo "La mail è stata inoltrata con successo.";

    } else {// ALTRIMENTI...

    echo "Si sono verificati dei problemi nell'invio della mail.";

    }

    ?>
    DOVE SBAGLIO MI DICE SEMPRE "Si sono verificati dei problemi nell'invio della mail."

    PERCHE'

  2. #2
    Moderatore di Server Apache L'avatar di marketto
    Registrato dal
    Sep 2001
    Messaggi
    5,858
    potresti togliere la @ dalla funzione mail x vedere quale errore ti ritorna
    think simple think ringo

  3. #3
    Questo e l'errore che ritorna:

    Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in c:\programmi\apache group\apache\test\coiniitalia\mail.php on line 21
    Si sono verificati dei problemi nell'invio della mail.


  4. #4
    Moderatore di Server Apache L'avatar di marketto
    Registrato dal
    Sep 2001
    Messaggi
    5,858
    stai provando a spedire le mail da locale?? hai configurato il php.ini per poter inviare mail??
    think simple think ringo

  5. #5
    si sto provando da locale, il php.ini lo guardato mi senbra apposto
    sono un principiante di sicuro sbaglio in qualche posto..

    mi potresti aiutare??
    e giusto così??

    [mail function]
    ; For Win32 only.
    SMTP = smtp.tiscali.it


    ; For Win32 only.
    sendmail_from = tecnicorocco@tiscali.it


  6. #6
    Moderatore di Server Apache L'avatar di marketto
    Registrato dal
    Sep 2001
    Messaggi
    5,858
    l'indirizzo specificato nel sendmail_from deve essere reale, così come quello usato nel header from.
    think simple think ringo

  7. #7
    Adesso lo corretto però non funziona lo stesso..


    <?php

    // L'INDIRIZZO DEL DESTINATARIO DELLA MAIL
    $to = "tecnicorocco@tiscali.it";

    // IL SOGGETTO DELLA MAIL
    $subject = "Informazioni dal Sito";

    // COSTRUIAMO IL CORPO DEL MESSAGGIO
    $body = "Contenuto del modulo:\n\n";
    $body .= "Nome: " . trim(stripslashes($_POST["Nome"])) . "\n";
    $body .= "Età: " . trim(stripslashes($_POST["Anni"])) . "\n";
    $body .= "Città: " . trim(stripslashes($_POST["City"])) . "\n";
    $body .= "Indirizzo: " . trim(stripslashes($_POST["Indirizzo"])) . "\n";
    $body .= "Note: " . trim(stripslashes($_POST["Note"])) . "\n";

    // INTESTAZIONI SUPPLEMENTARI
    $headers = "From: Modulo utenti<tecnicorocco@tiscali.it>";

    // INVIO DELLA MAIL
    if(mail($to, $subject, $body, $headers)) { // SE L'INOLTRO E' ANDATO A BUON FINE...

    echo "La mail è stata inoltrata con successo.";

    } else {// ALTRIMENTI...

    echo "Si sono verificati dei problemi nell'invio della mail.";

    }

    ?>



    CONFIGURAZIONE PHP.INI

    [mail function]
    ; For Win32 only.
    SMTP = smtp.tiscali.it


    ; For Win32 only.
    sendmail_from = tecnicorocco@tiscali.it

    ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
    sendmail_path = DEFAULT_SENDMAIL_PATH

    AIUTOOOOOOOOOOOOO

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.