Ho fatto la correzione.
A schermo compare:
Si sono verificati dei problemi nell'invio della mail
La mail non arriva.
Ho fatto la correzione.
A schermo compare:
Si sono verificati dei problemi nell'invio della mail
La mail non arriva.
Se stai cercando di inviare una mail da un pc tuo LOCALE con la funzione mail() non funziona.
Prova a metterla online e testare.
Altrimenti usa un SMTP per l'invio, ti consiglio classi come phpmailer
Google Partner | Senior Developer
Guida su Google Tag Manager
I due file sono on line..Se provi ad andare su altavaldiforfora.it in fondo trovi il form.
Ora devo uscire dopo provo io in locale e ti posto il codice.
Programmatore e responsabile seo della testata giornalistica www.europacalcio.it - www.canforagennaro.it
ok grazie
news per me ?
Come promesso, ecco il codice modificato e funzionante al 100% lo provato io stesso in locale.
P.s. ho aggiunto altre funzionalità che possono servirti, come l'ip utente, il browser che utilizza, data, ore...Codice PHP:<?php
if(isset($_POST['submitform']))
{
//ELIMINO CARATTERI HTML E METTO IL VALORE PASSATO PER POST NELLE VARIABILI
$nome = strip_tags($_POST['fullname']);
$email = strip_tags($_POST['email']);
$phone = strip_tags($_POST['phone']);
$subject = strip_tags($_POST['subject']);
$message = strip_tags($_POST['message']);
//SE IL CAMPO INPUT NON CONTIENE NULLA
if((trim($nome) == "")
OR (trim($email) == "")
OR (!@ereg("@",$email))
OR (trim($message) == ""))
{
Print "X Email non inviata
- Controlla i campi con l'asterisco
- Controlla l'indirizzo email";
}
else
{
//Dati per invio Email
$oggi = date("j F Y G:i"); // STAMPO LA DATA E L'ORA DI QUANDO E' STATA INVIATA L'EMAIL
$ip = "$_SERVER[REMOTE_ADDR]"; // STAMPO L'IP DI CHI MANDA L'EMAIL
$browser = "$_SERVER[HTTP_USER_AGENT]"; // STAMPO IL BROWSER CHE UTILIZZA L'UTENTE
$utente = "sappy88@hotmail.com";
$soggetto = "Modulo proveniente dal sito [url]www.altavaldiforfora.it[/url]";
//INVIO EFFETTIVO DELL'EMAIL
$body = "Ciao Tuo nome, \n ti hanno contattato trami il modulo contatta di Altavaldiforfora \n\n ";
$body .= "Nome : $nome \n Email : $email \n Tel : $phone \n Oggetto : $subject \n Messaggio : $message \n\n";
$body .= "Email inviata il $oggi \n da IP : $ip \n Con Browser : $browser \n\n";
$body .= "Un Sistema by Exitpeople.com";
mail("$utente","$soggetto","$body");
Print"L'email è stata inviata con successo, l'amministratore del sito si impegnerà a rispondere nel più breve tempo possibile.";
}
}
?>
<div id="contactform">
<h2>Why Not Contact Us Today !</h2>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
<fieldset>
<legend>Contact Form</legend>
<label for="fullname">Name:
<input id="fullname" name="fullname" type="text" value="" />
</label>
<label for="email" class="margin">Email:
<input id="email" name="email" type="text" value="" />
</label>
<label for="phone">Telephone:
<input id="phone" name="phone" type="text" value="" />
</label>
<label for="subject" class="margin">Subject:
<input id="subject" name="subject" type="text" value="" />
</label>
<label for="message">Message:
<textarea id="message" name="message" cols="80" rows="8"></textarea>
</label>
<input id="submitform" name="submitform" type="submit" value="Submit" />
<input id="resetform" name="resetform" type="reset" value="Reset" />
</fieldset>
</form>
</div>
P.s. tutto il codice va in una sola pagina web. Fammi sapere
Programmatore e responsabile seo della testata giornalistica www.europacalcio.it - www.canforagennaro.it
Dammi 5 minuti che aggiorno i file e ti fo sapere..Intanto grazie per l'aiuto
Ho aggiornato i file con il tuo codice. Provo a compilare il form e cliccando su submit mi rende:
http://altavaldiforfora.it/%3C?php%20$_SERVER[%27PHP_SELF%27]%20?%3E
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:
Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
Technical Information (for support personnel)
Go to Microsoft Product Support Services and perform a title search for the words HTTP and 404.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Web Site Setup, Common Administrative Tasks, and About Custom Error Messages.
Il file mail.php e caricato nella stessa zona dove è caricato il file index.html
Sbaglio in qualche passaggio ?
Ma per caso utilizzi qualche piattaforma ?
Prova così
Codice PHP:<?php
if(isset($_POST['submitform']))
{
//ELIMINO CARATTERI HTML E METTO IL VALORE PASSATO PER POST NELLE VARIABILI
$nome = strip_tags($_POST['fullname']);
$email = strip_tags($_POST['email']);
$phone = strip_tags($_POST['phone']);
$subject = strip_tags($_POST['subject']);
$message = strip_tags($_POST['message']);
//SE IL CAMPO INPUT NON CONTIENE NULLA
if((trim($nome) == "")
OR (trim($email) == "")
OR (!@ereg("@",$email))
OR (trim($message) == ""))
{
Print "X Email non inviata
- Controlla i campi con l'asterisco
- Controlla l'indirizzo email";
}
else
{
//Dati per invio Email
$oggi = date("j F Y G:i"); // STAMPO LA DATA E L'ORA DI QUANDO E' STATA INVIATA L'EMAIL
$ip = "$_SERVER[REMOTE_ADDR]"; // STAMPO L'IP DI CHI MANDA L'EMAIL
$browser = "$_SERVER[HTTP_USER_AGENT]"; // STAMPO IL BROWSER CHE UTILIZZA L'UTENTE
$utente = "sappy88@hotmail.com";
$soggetto = "Modulo proveniente dal sito [url]www.altavaldiforfora.it[/url]";
//INVIO EFFETTIVO DELL'EMAIL
$body = "Ciao Tuo nome, \n ti hanno contattato trami il modulo contatta di Altavaldiforfora \n\n ";
$body .= "Nome : $nome \n Email : $email \n Tel : $phone \n Oggetto : $subject \n Messaggio : $message \n\n";
$body .= "Email inviata il $oggi \n da IP : $ip \n Con Browser : $browser \n\n";
$body .= "Un Sistema by Exitpeople.com";
mail("$utente","$soggetto","$body");
Print"L'email è stata inviata con successo, l'amministratore del sito si impegnerà a rispondere nel più breve tempo possibile.";
}
}
?>
<div id="contactform">
<h2>Why Not Contact Us Today !</h2>
<form action="" method="post">
<fieldset>
<legend>Contact Form</legend>
<label for="fullname">Name:
<input id="fullname" name="fullname" type="text" value="" />
</label>
<label for="email" class="margin">Email:
<input id="email" name="email" type="text" value="" />
</label>
<label for="phone">Telephone:
<input id="phone" name="phone" type="text" value="" />
</label>
<label for="subject" class="margin">Subject:
<input id="subject" name="subject" type="text" value="" />
</label>
<label for="message">Message:
<textarea id="message" name="message" cols="80" rows="8"></textarea>
</label>
<input id="submitform" name="submitform" type="submit" value="Submit" />
<input id="resetform" name="resetform" type="reset" value="Reset" />
</fieldset>
</form>
</div>
Programmatore e responsabile seo della testata giornalistica www.europacalcio.it - www.canforagennaro.it