Pilamailin avulla voi lähettää kanen tahansa sähköpostiosoitteesta viestin.
<?php
$fileLocation = $HTTP_SERVER_VARS["PHP_SELF"];
$fileName = basename ($fileLocation);
$notcomplete = false;
$nodata = false;
if ( !isset($_POST["mailto"]) ) {
$nodata = true;
}
if ( !isset($_POST["subject"]) ){
$nodata = true;
}
if ( !isset($_POST["email"]) ){
$nodata = true;
}
if ( !isset($_POST["name"]) ){
$nodata = true;
}
if ( !isset($_POST["message"]) ){
$nodata = true;
}
if ($nodata){
?>
<form action="<?=$fileName?>" method="post">
<table border="0" cellpadding="0" cellspacing="0"><tr><td>
PILA-MAIL<br><br>
Nimi: <br><input type="text" value="" name="name" size="20"><br>
Sähköpostiosoite:<br><input type="text" value="" name="email" size="20"><br>
Aihe: <br><input type="text" value="" name="subject" size="20"><br>
Vastaanottaja: <br><input type="text" value="" name="mailto" size="20"><br>
Viesti: <br><textarea name="message" cols="30" rows="6"></textarea><br>
<input type="submit" name="submit" value=" Lähetä "></td></tr></table></form>
<?php
exit("");
}//end if nodata
if ( trim($_POST["mailto"] == "") ){
$notcomplete = true;
}
if ( trim($_POST["subject"] == "") ){
$notcomplete = true;
}
if ( trim($_POST["email"] == "") ){
$notcomplete = true;
}
if ( trim($_POST["name"] == "") ){
$notcomplete = true;
}
if ( trim($_POST["message"] == "") ){
$notcomplete = true;
}
if ($notcomplete){
echo "missing required parameter";
//you could change the a
exit ('a href="javascript:history.back(1)"> click here a');
}
$mailto = $_POST["mailto"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$name = $_POST["name"];
//$mailto = "$mailto";
//$subject = "$subject";
$msg = ereg_replace("\\\'", "'", $message);
$msg1 = ereg_replace('\\\"', "\"", $msg);
$message1 = "From: $name\nemail: $email\nmessage:\n$msg1";
$sent = mail($mailto, $subject, $msg, "From: $email\r\nReply-to: $email\r\n");
if ($sent){
echo ("Viestisi on lähetetty osoitteeseen $mailto!");
}else{
echo "Viestin lähetys epäonnistui";
}
?>Mistäs tähän voi valita smtp serverin?
smtp serveriä ei ole pakko valita, mutta koodia voi muunnella itselleen sopivaksi.
Aihe on jo aika vanha, joten et voi enää vastata siihen.