PDA

View Full Version : [PHP] modulo email dal mio sito (niubbo!)


mattewRE
23-11-2008, 12:20
Dovrei integrare sul mio prossimo sito (non quello in firma) un modulo che permetta ai visitatori di mandarmi una mail.
Ho trovato questo codice. Mi aiutate a modificarlo affinché funzioni?
oltre a:
$receiver = "tuo [email protected]"
cosa devo pre-impostare?
non so se vi serve, ma il mio indirizzo email è @gmail.com

Grazie!

<?php

$contact_name = $_POST['name'];

$contact_email = $_POST['email'];

$contact_subject = $_POST['subject'];

$contact_message = $_POST['message'];



if( $contact_name == true )

{

$sender = $contact_email;

$receiver = "tuo [email protected]";

$client_ip = $_SERVER['REMOTE_ADDR'];

$email_body = "Name: $contact_name \nEmail: $sender \nSubject: $contact_subject \nMessage: $contact_message \nIP: $client_ip \nFlash Contact Form provided by http://www.flashmo.com";

$extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();



if( mail( $receiver, "Flash Contact Form - $subject", $email_body, $extra ) )

{

echo "success=yes";

}

else

{

echo "success=no";

}

}

?>

malocchio
23-11-2008, 13:49
Non sono esperto, ma consiglierei un po' di espressioni letterali per verificare i campi di input ed evitare l'injection.

Chiedi a qualcuno del forum oppure cerca con google espressioni letterali adatte a indirizzi email.

Sempre se ti interessa un po' di sicurezza :stordita:

mattewRE
23-11-2008, 14:33
dimmi se ho capito:
dovrei far si che escano quei quei caratteri di verifica da ricopiare?

Hardware Upgrade Forum Database Error
Database Error Database error
The Hardware Upgrade Forum database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.hwupgrade.it home page, then try to open another page.
  • Click the Back button to try another link.
The www.hwupgrade.it forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.