|
|
|
|
|
|
| |
A small tell a friend script that allows your visitors to send a mail to their friends with your customised messages :)
| <?php
//Your website anem goes here:
$site_name = "Web site";
//The subject of the mail
$subject = "Tell a friend";
//Edit the body of the message to be sent here
$body = "Hello,<br><br>Your friend $name ($email) has recommended that you see our website $site_name. He has also sent this message along with the recommendation:<br>" . $message . "<br> Thank you,<br>-The managment";
////////////////////////////////////////////////////////////////////////////////////
// Do Not Edit Below Here Unless You Know What You Are Doing
////////////////////////////////////////////////////////////////////////////////////
if($_POST["send"] == "true") {
$to = $_POST["to"];
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
if (($name == "") OR ($email == "") OR ($message == "")) {
print ("<div id=\"sectionContent\">");
print ("<font color=\"red\">One of the fields was left blank. Please put something in all fields.</font><br><br>");
print ("</div><br>");
email_form();
}elseif(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $email)) {
$recipient = $to;
$subject = $the_subject;
$additional_headers = ("From: $email\n");
if(mail($recipient, $subject, $body, $additional_headers)) {
print ("<div id=\"sectionContent\">");
print ("<font color=\"red\">Error. Tell a friend script mailed your friend at $to about $site_name successfully.<br>Thank you.</font><br><br>");
print ("</div><br>");
}else{
print ("<div id=\"sectionContent\">");
print ("<font color=\"red\">Uh-Oh! Something went wrong with the script! Please try again.</font><br><br>");
print ("</div><br>");
$send = "false";
email_form();
}
}else{
print ("<div id=\"sectionContent\">");
print ("<font color=\"red\">That email address does not appear to be valid. Please try again.</font><br><br>");
print ("</div><br>");
$send = "false";
email_form();
}
}else{
print ("<div id=\"sectionContent\">");
print ("<p align=\"center\"><font size=\"62\">Tell a friend</font></p>");
print ("</div><br>");
email_form();
}
function email_form(){
global $subject_array, $recipient_array, $this_script, $PHP_SELF;
print ("<div id=\"sectionContent\">");
print ("<form METHOD=POST action=\"$PHP_SELF\">\n");
print ("<table align=\"center\" border=\"1\" bordercolor=\"E0E8EF\"><tr><td align=\"left\">");
print ("To:<br>\n");
print ("</td><td>");
print ("<input type=\"text\" name=\"to\" size=\"30\"><br>\n");
print ("</td></tr><tr><td align=\"left\">");
print ("Name:<br>\n");
print ("</td><td>");
print ("<input type=\"text\" name=\"name\"><br>\n");
print ("</td></tr><tr><td align=\"left\">");
print ("Your Email Address:<br>\n");
print ("</td><td>");
print ("<input type=\"text\" name=\"email\" size=\"40\"><br>\n");
print ("</td></tr><tr><td align=\"left\">");
print ("Your Message:<br>\n");
print ("</td><td>");
print ("<textarea cols=\"50\" rows=\"5\" name=\"message\"></textarea><br>\n");
print ("</td></tr><tr><td>");
print ("</td>");
print ("<td>");
print ("<input type=\"hidden\" name=\"send\" value=\"true\">\n");
print ("<input type=\"submit\" value=\"Submit\"> \n");
print ("<input type=\"reset\" value=\"Reset Fields\">\n");
print ("</td></tr></table>");
print ("</form>\n");
print ("<div align=\"center\"><font size=\"1\" color=\"888888\">");
print ("script by <a href=\"mailto:leapinglangoor@yahoo.co.in\">leapinglangoor</a>");
print ("</font></div>");
print ("</div>");
}
?> | | |
|
| Using this script anyone can easily get a form result to his/her mailbox. You can use this script for any form 2 mail purpose. Categories : PHP, Mail, Form Processing | | | Password reminder Categories : PHP, PHP Classes, Databases, MySQL, Mail | | | Email Class Categories : PHP, Mail, PHP Classes | | | Protect your email links from being spidered by spam email robots! Categories : PHP, Security, Mail, Email | | | Data Retrieve from mailbox and generate the SQL Syntax Categories : PHP, IMAP, Mail | | | mail -- send mail Categories : PHP, PHP Functions, Mail | | | XPertMailer - Sends TRUE Mails Categories : PHP, Mail, SMTP, PHP Classes | | | Convert text to 'quoted printable' without the IMAP package installed. Categories : PHP, Mail, IMAP | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Simple Maiing list with newsletter support Categories : PHP, PHP Classes, Mail | | | tinySendMail and tinySockMail functions for generating SMTP mail within PHP Categories : PHP, Mail, SMTP | | | Sending mail to a mailing list and showing progress Categories : PHP, Mail, Beginner Guides | | | send php mail with form data and attachment. Categories : PHP, Email, Mail, Form Processing | | | Retrieve text from table and email to your e-
address in pipe delimited format. Categories : PHP, MySQL | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | |
|
|
|