05-21-2000, 06:55 PM
Send an email from one registered user to another with this:
// ############################### start email form ###############################
if ($action=="mailform") {
echo "<form action=\"member.php\" method=post>\n";
echo "<input type=hidden name=action value=sendmail>\n";
echo "To:<br><input name=username value=\"$username\"><br>\n";
echo "From:<br><input name=from value=\"$bbusername\"><br>\n";
echo "Subject:<br><input name=subject value=\"From @forums Member\"><br>\n";
echo "Message:<br><textarea rows=10 cols=40 name=message></textarea><br>\n";
echo "<input type=submit>\n";
echo "</form>\n";
}
// ############################### start send email ###############################
if ($action=="sendmail") {
$body=urldecode($message);
$title=urldecode($subject);
$username=urldecode($username);
$fromusername=urldecode($from);
$user=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes($username)."'");
$userid=$user[userid];
$userinfo=$DB_site->query_first("SELECT username,email FROM user WHERE userid=$userid");
$useremail=$userinfo[email];
$username=$userinfo[username];
$fromuser=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes($fromusername)."'");
$fromuserid=$fromuser[userid];
$fromuserinfo=$DB_site->query_first("SELECT username,email FROM user WHERE userid=$fromuserid");
$fromuseremail=$fromuserinfo[email];
$fromusername=$fromuserinfo[username];
$fromuser="\"$fromusername\" <$fromuseremail>";
mail("\"$username\" <$useremail>", $title, $body, "From: $fromuser");
echo "Mail Sent!\n";
}
Just put this snippit into "member.php" and update the "postbit_useremail" so that the HREF points to "member.php?action=mailform&username=$username"
[Edited by Lord Raven on 05-22-2000 at 01:58 AM]
// ############################### start email form ###############################
if ($action=="mailform") {
echo "<form action=\"member.php\" method=post>\n";
echo "<input type=hidden name=action value=sendmail>\n";
echo "To:<br><input name=username value=\"$username\"><br>\n";
echo "From:<br><input name=from value=\"$bbusername\"><br>\n";
echo "Subject:<br><input name=subject value=\"From @forums Member\"><br>\n";
echo "Message:<br><textarea rows=10 cols=40 name=message></textarea><br>\n";
echo "<input type=submit>\n";
echo "</form>\n";
}
// ############################### start send email ###############################
if ($action=="sendmail") {
$body=urldecode($message);
$title=urldecode($subject);
$username=urldecode($username);
$fromusername=urldecode($from);
$user=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes($username)."'");
$userid=$user[userid];
$userinfo=$DB_site->query_first("SELECT username,email FROM user WHERE userid=$userid");
$useremail=$userinfo[email];
$username=$userinfo[username];
$fromuser=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes($fromusername)."'");
$fromuserid=$fromuser[userid];
$fromuserinfo=$DB_site->query_first("SELECT username,email FROM user WHERE userid=$fromuserid");
$fromuseremail=$fromuserinfo[email];
$fromusername=$fromuserinfo[username];
$fromuser="\"$fromusername\" <$fromuseremail>";
mail("\"$username\" <$useremail>", $title, $body, "From: $fromuser");
echo "Mail Sent!\n";
}
Just put this snippit into "member.php" and update the "postbit_useremail" so that the HREF points to "member.php?action=mailform&username=$username"
[Edited by Lord Raven on 05-22-2000 at 01:58 AM]