Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it L'avatar di monzon
    Registrato dal
    Nov 2009
    Messaggi
    27

    EMAIL FORM - Dove sta l'errore?

    Ciao a tutti

    sto lavorando in locale per la progettazione di un semplice sito. Devo creare un email form ed ho inserito il seguente codice:

    <?php

    if ($_POST['submit'] == TRUE) {
    $receiverMail = "enzocampolo@hotmail.com";
    $name = stripslashes(strip_tags($_POST['name']));
    $email = stripslashes(strip_tags($_POST['email']));
    $subject = stripslashes(strip_tags($_POST['subject']));
    $msg = stripslashes(strip_tags($_POST['msg']));
    $ip = $_SERVER['REMOTE_ADDR'];
    $msgformat = "From: $name ($ip)\nEmail: $email\n\n$msg";

    if(empty($name) || empty($email) || empty($subject) || empty($msg)) {
    echo "<h2>The email was not sent</h2>

    Please fill all the required fields</p>";
    }
    elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
    echo "<h2>The email was not sent</h2>

    The email address is invalid</p>";
    }
    elseif(mail($receiverMail, $subject, $msgformat, "From: $name <$email>")) {
    echo "<h2>The email has been sent!</h2>

    I will get back to you as soon as possible.</p>"; }
    else {
    echo "<h2>The email was not sent</h2>

    Please try again... If the problem continues there's probably something wrong with the server.</p>";
    }
    }
    else { ?>
    <body bgcolor="#800000" text="#FFFFFF">
    <form method="post" action="email.php">


    <label for="name">Nome</label>
    <input id="name" name="name" type="text" size="30" maxlength="40" />


    <label for="email">Email</label>
    <input id="email" name="email" type="text" size="30" maxlength="40" />

    <label for="subject">Oggetto</label>
    <input id="subject" name="subject" type="text" size="30" maxlength="40" />

    <label for="message">Testo</label>
    <textarea id="message" name="msg" cols="50" rows="6"></textarea>


    <label for="submit"></label>
    <input id="submit" class="button" type="submit" name="submit" value="Send" />
    </p>
    </form>
    <?php } ?>

    dove sto sbagliando? mi da sempre errore

    grazie a tutti coloro che vorranno aiutarmi

  2. #2
    Utente di HTML.it L'avatar di carlo2002
    Registrato dal
    Jun 2002
    Messaggi
    2,747
    Inserendo il codice tra gli appositi tag [ p h p ] .... [ / p h p ] (senza spazi)

    e

    indicando il tipo di errore

    aiuteresti chi ti vuole aiutare...

    imho
    Errare humanum est, perseverare ovest

  3. #3
    Utente di HTML.it L'avatar di monzon
    Registrato dal
    Nov 2009
    Messaggi
    27
    il probelma è che non ho completamente idea di dove possa essere l'errore...

  4. #4
    Ti dice che non puoi mandare l'email?
    In locale hai montato un server smtp?

  5. #5
    Utente di HTML.it L'avatar di monzon
    Registrato dal
    Nov 2009
    Messaggi
    27
    The email was not sent Please try again... If the problem continues there's probably something wrong with the server

    questo è l'errore che mi da...non ho montanto nessun server smtp...tu cosa mi consigli...ho provato con hmail server ma non riesco neanche a fare i settaggi...

  6. #6
    Moderatore di PHP L'avatar di Alhazred
    Registrato dal
    Oct 2003
    Messaggi
    12,509
    Qui c'è la documentazione di hmail, l'hai letta?

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.