<?php /************************************************
* Snippet Name : URL Mailer *
* Scripted By : Hermawan Haryanto *
* Email : hermawan@codewalkers.com *
* License : GPL (General Public License) *
***********************************************/
if ($_POST) {
$from_name = htmlentities(trim($_POST["from_name"]), ENT_QUOTES);
$from_email = htmlentities($_POST["from_email"], ENT_QUOTES);
if ($from_name != "" && $from_email != "") $from = "$from_name <$from_email>";
elseif ($from_name == "" && $from_email != "") $from = $from_email;
else $from = "Anonymous <anonymous@myserver.com>";
$to_name = htmlentities ($_POST["to_name"], ENT_QUOTES);
$to_email = htmlentities($_POST["to_email"], ENT_QUOTES);
if ($to_name != "" && $to_email != "") $to = "$to_name <$to_email>";
elseif ($to_name == "" && $to_email != "") $to = $to_email;
else $to = "Hermawan Haryanto <hermawan@codewalkers.com>";
$url = trim($_POST["url"]);
if ($url != "") {
if (allow_url_fopen) {
$message = file_get_contents ($url);
} else {
$message = "Your friend is trying to send you this page: $url rn";
$message.= "But the server is unable to deliver it for you.";
}
} else {
$message = "No HTML to display.";
}
$subject = "[URLMailer] ".stripslashes(trim($_POST["subject"]));
if ($subject == "") $subject = "[URLMailer] No Subject";
$headers = "MIME-Version: 1.0rn";
$headers.= "Content-type: text/html; charset=iso-8859-1rn";
$headers.= "From: $from rn";
@mail ($to, $subject, $message, $headers);
Header ("Location:".$_SERVER["PHP_SELF"]."?send=done");
exit();
}
if ($_GET["send"] == "done") {
$str = "<script language="JavaScript">n";
$str.= "alert('Email has been sent.!');n";
$str.= "</script>n";
print $str;
} ?> <pre>
<form method="post">
To (Name) : <input type="text" name="to_name" width="25">
To (Email): <input type="text" name="to_email" width="25">
From (Name) : <input type="text" name="from_name" width="25">
From (Email): <input type="text" name="from_email" width="25">
Subject : <input type="text" name="subject" width="25">
URL : <input type="text" name="url" width="25">
<input type="submit" name="action" value="SEND">
</form>
</pre>
|
|