i want to make a mailfrom script, that selects the email of a user automaticaly from the database and sends mail to a user. This script is usefull for users, where users can send mail to eachother.
Right now i am using a mailto function like this, wich opens automaticaly Outlook Exprees or other Email clients.
Code: Select all
<a href=mailto:$email_p><img src=images/email.jpg border=0></a>Can any one explan me wich steps do i have to take to make that script work, so far i made this:
Code: Select all
$msg = "MESSAGE FROM SITE\n";
$msg .= "Sender's Name: $_POST[sender_name]\n";
$msg .= "Sender's E-Mail: $_POST[sender_email]\n";
$msg .= "Message: $_POST[message]\n\n";
$subject = "message from a user";
@mysql_connect(localhost,"zzzzzzz","xxxxxxx");
@mysql_select_db("xxxxxxx") or die( "<CENTER> Couldnt find a database.");
$query = "SELECT * FROM users WHERE email='$email'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if ($num > 0) {
}
//send the mail
mail($to, $subject, $msg, $mailheaders);