WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Tell a friend script :)
Categories : PHP, Mail Click here to Update Your Picture
leaping langoor
Date : May 31st 2004
Grade : 3 of 5 (graded 2 times)
Viewed : 11745
File : No file for this code example.
Images : No Images for this code example.
Search : More code by leaping langoor
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

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>");
}
?>



Convert text to 'quoted printable' without the IMAP package installed.
Categories : PHP, Mail, IMAP
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
Protect your email links from being spidered by spam email robots!
Categories : PHP, Security, Mail, Email
XPertMailer - Sends TRUE Mails
Categories : PHP, Mail, SMTP, PHP Classes
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Email Class
Categories : PHP, Mail, PHP Classes
Simple Maiing list with newsletter support
Categories : PHP, PHP Classes, Mail
send php mail with form data and attachment.
Categories : PHP, Email, Mail, Form Processing
Sending mail to a mailing list and showing progress
Categories : PHP, Mail, Beginner Guides
tinySendMail and tinySockMail functions for generating SMTP mail within PHP
Categories : PHP, Mail, SMTP
mx lookup
Categories : PHP, Mail
mail -- send mail
Categories : PHP, PHP Functions, Mail
Password reminder
Categories : PHP, PHP Classes, Databases, MySQL, Mail
Data Retrieve from mailbox and generate the SQL Syntax
Categories : PHP, IMAP, Mail
an example of the cyberlib payment class
Categories : PHP, PHP Classes, Ecommerce, Credit Cards