Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage
Php > E-Mail sample source codes
Email a user with out exposing email address
Email a user with out exposing email address Keeping emails hidden is an increasing concern with all the spam floating around. Here is a way using MySQL and a contact form to allow a group of users on a site to contact each other safely... Bastien "; $your_email = ''; } //check to see if the other elements have values if(empty($message)) { $err_msg .= "No message set. Please enter a message.
"; } if(empty($subject)) { $err_msg .= "No subject set. Please enter a subject.
"; } if(empty($your_name)) { $err_msg .= "No sender name set. Please enter a your name.
"; } //check the err_msg to see if there are any messages if ($err_msg != ''){ //there is an error so build the data into a pipe delimited string and pass it back to the form $data = "$id|$subject|$message|$your_email|$your_name"; show_form($data,$err_msg); die(); }//end if //get the email from the db and send it $sql = "select email from contacts where id = $id"; $result = conn($sql); if(mysql_num_rows($result)==1) { $row = mysql_fetch_array($result); $email = $row['email']; } //send the email //build the headers $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; $headers .= "X-Priority: 1\n"; $headers .= "X-MSMail-Priority: High\n"; $headers .= "X-Mailer: PHP\n"; $headers .= "From: \"".$your_name."\" <".$your_email.">\n"; if (!mail($email, $subject, $message, $headers)) { echo "Email failed!\nTry again"; show_form(); }else{ echo "