Gossamer Forum
Home : Products : DBMan : Installation :

semi-invisible email links for privacy

Quote Reply
semi-invisible email links for privacy
I want to add email to dbman (looking through the FAQ's on that) But I want the link to show only the Username for privacy purposes. You know that recently there are many freaks out there and I want users to feel a little more safer. For example: User "Jonny" real name (who cares) email "jonny@foo.com" to be translated to only "jonny" and DBMAN takes care of the rest.
Is this possible?
Quote Reply
Re: semi-invisible email links for privacy In reply to
Someone asked something similar in the other DBMan forum.

Yes, you could have a form with a textarea where folks could send email to someone and click on a button to have DBMan look up the email address and then mail the text from the textarea. I just would have to work on it a while to know how to do it.


------------------
JPD





Quote Reply
Re: semi-invisible email links for privacy In reply to
I can wait Smile thanks JP
Quote Reply
Re: semi-invisible email links for privacy In reply to
Okay. I finally worked out the mod for more privacy in sending email. (It needed some brain time. Smile )

This has not been tested, except that I'm pretty sure there aren't any syntax errors. I'm pretty sure it will work, though.

I'll post the whole thing here and, when I can, I'll upload the text file to my site and list it in the resources. Things in bold need to be edited by you.

First, in default.cfg add a line
Code:
# The email program on your system
$mailprog = "|/usr/lib/sendmail -t";

In db.cgi, sub main (where all the other "elsif" statements are) add
Code:
elsif ($in{'send_email_form'}) { &html_send_email_form; }
elsif ($in{'send_email'}) { &send_email; }

also in db.cgi, a new subroutine. You can add it anywhere, as long as it's not within another subroutine.

Code:
sub send_email {

unless ($in{'email'}) { $message = "You must fill in your email address<BR>"; }
unless ($in{'email'} =~ /.+\@.+\..+/) { $message = "Your email address is not in the correct format.<BR>"; }
unless ($in{'subject'}) { $message .= "You must fill in a subject for your message.<BR>"; }
unless ($in{'emailmessage'}) { $message .= "Your email message is empty.<BR>"; }

%rec = &get_record($in{$db_key});

if (!%rec) { $message .= "The email address you requested could not be found.<BR>"; }
if (!$rec{'Email'}) { $message .= "There is no email address on file for this person.<BR>" }

if ($message) {
chomp($message);
&html_send_email_form($message);
return;
}

open (MAIL, "$mailprog") | | &cgierr("unable to open mail program");
print MAIL "To: $rec{'Email'}\n";
print MAIL "From: $in{'email'}\n";
print MAIL "Subject: $in{'subject'}\n\n";
print MAIL "-" x 75 . "\n\n";

print MAIL $in{'emailmessage'};

close (MAIL);

&html_send_email_success($rec{'Name'});
}
Be sure to change the field names to the names in your database.

In html.pl, sub html_record, wherever you want the link to be to send an email to the person -- this must be within a print qq| statement.

Code:
<a href="$db_script_link_url&$db_key=$rec{$db_key}&send_email_form=1">Send email to this person</a>

html.pl -- new subroutine
Code:
sub html_send_email_form {

my ($message) = $_[0];

%rec = &get_record($in{$db_key});

&html_print_headers;

# <-- top of page formatting -->
print qq|
<html><head><title>$html_title: Send an email</title></head>
<body bgcolor="#DDDDDD">
<center>
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 align=center valign=top>
<tr><td colspan=2 bgcolor="navy">
<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
<b>$html_title: Send an email</b></td></tr>
<tr><td>
<p><center><$font_title><b>
Send an email
</b></font></center><br>
|;

# <-- introductory text -->

if ($message) { print qq|There was a problem: $message|; }

print qq|
<$font>Fill in your email address, the subject of your email and the
message you wish to send to $rec{'Name'}.</font>
|;

# <-- email form -->

print qq|
<form action="$db_script_url" method="POST">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<input type=hidden name="$db_key" value="$in{$db_key}">
<table><tr><td align=right><$font>Your email address:</font></td>
<td><input type=text name="email" value="$in{'email'} size=40></td></tr>
<tr><td align=right><$font>Subject:</font></td>
<td><input type=text name="subject" value="$in{'subject'} size=40></td></tr>
<tr><td align=right><$font>Your email address:</font></td>
<td><textarea name="emailmessage" width=40 height=10>$in{'emailmessage'}</textarea></td></tr>
</table>
<center>
<INPUT TYPE="SUBMIT" NAME="send_email" VALUE="Send Email">
<INPUT TYPE="RESET" VALUE="Reset Form">
</center>
</form>
|;

# <-- end of page formatting -->

&html_footer;

print qq|</td></tr></table></body></html>|;
}
Again, be sure to change the field names to match your database.

html.pl -- another new subroutine
Code:
sub html_send_email_success {

my ($message) = $_[0];

&html_print_headers;

# <-- top of page formatting -->
print qq|
<html><head><title>$html_title: Send an email</title></head>
<body bgcolor="#DDDDDD">
<center>
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 align=center valign=top>
<tr><td colspan=2 bgcolor="navy">
<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
<b>$html_title: Send an email</b></td></tr>
<tr><td><p><center><$font_title><b>
Send an email
</b></font></center><br>
|;

# <-- text -->

print qq|<$font>Your email message was sent to $message.</font>|;

# <-- end of page formatting -->

&html_footer;

print qq|</td></tr></table></body></html>|;
}

If anybody uses this, I'd really appreciate your letting me know how it works for you, good or bad.

------------------
JPD


[This message has been edited by JPDeni (edited March 29, 1999).]
Quote Reply
Re: semi-invisible email links for privacy In reply to
ALL I can say is WOW !!!

Give me a day or 2 to implament this. It looks like a major job for me. Boy, JP YOU'RE really great!
Quote Reply
Re: semi-invisible email links for privacy In reply to
Hi JPDeni,

This mod looks to be just what I need.

If you read this a little while ago please disregard the error messages I pasted in here. I had some things put into the wrong file. I'll try this mod from a scratch installation and see how it runs. Then I'll try to incorporate the changes I've made.

I'll post back the results soon...

TNX!!!!!!!!!

[This message has been edited by Train (edited March 30, 1999).]
Quote Reply
Re: semi-invisible email links for privacy In reply to
The problem is because of UBB. If you put two | characters next to each other, for some reason, UBB puts a space between them. Take out the space between the two &#0124; &#0124; characters.

If you still have problems with the email program thing, contact your server admin and ask where "sendmail" is.


------------------
JPD





Quote Reply
Re: semi-invisible email links for privacy In reply to
Holy Moley!!!!!

It works! :0)

I don't know how to thank you enough for this mod. It's been a thorn in my side for a long time now.

Now I'll mail Alex a check for dbman and I'm off and running!

Thanks so much!
Quote Reply
Re: [Train] semi-invisible email links for privacy In reply to
Note to those coming to this thread looking for a mod to hide your database members' emails: JP Deni modified the above mod -- the more recent version is on her website at: http://www.jpdeni.com/dbman/mods.html

I would recommend using the later one. I first tried to implement the one described in this thread and had problems. But the later one worked fine.

(Note: This suggestion is coming from a complete novice. But maybe it'll be useful nonetheless.)

Hope this helps,
Liza

Last edited by:

Liza: Jul 28, 2002, 10:11 PM