Gossamer Forum
Quote Reply
mailer
My last post was deleted by mistake. Anyway, I'm trying to use the mailer mod from Eliot's site for the review's, but am a little unsure on how to get it to recongize each individiual posters email. Any ideas? Thanks.

Quote Reply
Re: mailer In reply to
I don't understand why you can't get it to work....

All you have to do is change the following line in the mailer.cgi file:

Code:

require "$db_lib_path/links.def";


to the following:

Code:

require "$db_lib_path/review.def";


And if you have not changed the Contact Email field, then the rest of the script should work fine. If you have changed Contact Email in the review.def to another field name, then you simply change the following codes:

Code:

my $to = $rec{'Contact Email'};


to the following:

Code:

my $to = $rec{'EmailFieldName'};


Change EmailFieldName to the name of your email field.

Wink

Got it?

Regards,

Eliot Lee
Quote Reply
Re: mailer In reply to
Duh....sometimes I just amaze myself! I had it pointing to the rev def file....but when I was testing it, I would just call the script from the location mailer.cgi?ID=xx, rather then from the link on the page----so I kept getting unknown tags! All should be fine now----I'm going to try again. Thanks Eliot.

Quote Reply
Re: mailer In reply to
You have to add the following tag definitions in the mailer sub-routines:

Code:

Name => $fields{'Contact Name'}


Then you can use Name in the template pages. Also, you need to add hidden fields in the mailer_form.html and mailer_error.html template files:

Code:

<input type="hidden" name="Name" value="<%Name%>">


Then you can use <%Name%> in your template files.

Also, you will need to have a hidden field for the ID field, like the following:

Code:

<input type="hidden" name="ID" value="<%ID%>">


In terms of "linking" the mailer form from the Reviews...All you have to do is add the following link in the review.html file:

Code:

<a href="< Û_cgi_url% >/mailer.cgi?ID?ID=<%ID%>">Send Private Message</a>


Remove all spaces before and after the hash marks (%).

To see this in action, go to:

http://vlib.anthrotech.com/bin/review.cgi?ID=1139

Click on the Reviewer's Name.

Regards,

Eliot Lee
Quote Reply
Re: mailer In reply to
Ok...I spoke to soon. I'm having two problems.

1) Unkown Tag: Contact Name & Contact Email
----yes I've checked 5 times now-----those are the correct field names.

2) Lets say there are two reviews for Gossamer Threads one guys email is 123@gt.com and the other guys email is 345@gt.com. Now the whole idea here is that I do not want these emails to show (that's the purpose of the mailer program), however I want to give the users the ability to send a mail to either of these people via the mailer.cgi form.

Basically, I think I'm confused on where the script is looking for this information, not to mention I can't seem to correct these unknown tags. Anyway, if you could give me some assistance on this that would be very cool!

Quote Reply
Re: mailer In reply to
Looks like you read my mind (we must have been posting at the same time).....I'll look over your post and see what's happening! Thanks alot Eliot, I appreciate you taking the time to lend me a hand on this.

Quote Reply
Re: mailer In reply to
Database 101: Primary Keys

In databases, there is a primary key field (defined as $db_key variable in Perl with flat file databases). For the review.db file, the primary key field is the ID field and that field is used for the mailer.cgi file. The ID field is associated with ONE email address. Thus, the script will ONLY send out ONE email message at a time.

GOT it??

Regards,

Eliot Lee
Quote Reply
Re: mailer In reply to
Ok....I went to your page---you just added this option in the past couple of hours! I was there earlier today and didn't see it, and I noticed you had "hide email" or "show email" as an option and now it's gone? But, yeah....that's what I'm looking to do...hopefully I can get it worked out....it looks like you did. I haven't resolved the unknown tags yet---but I'm getting Invalid ID: 2 (2 stands for the ID of the person who submitted the review). I've added the link correctly on the review page, because the link changes for each person:
?ID=2 and ?ID=3 etc., but not sure now why I'm getting an Invalid ID: 2---I know it's the right number that is related to that email in the review.db--but what's up?

Quote Reply
Re: mailer In reply to
Finally.....man, I got it! Thanks alot, Eliot.....you saved me some headaches!

Quote Reply
Re: mailer In reply to
Excuse me...This option has been there for the past three weeks. Don't know what you're thinking! Mad You need to go to the eye doctor and get an eye check-up since I have had this option up and running since May 28, 2000.

Anyway...I forgot that I had edited the Private Mailer Mod to work directly with the parse_form sub...

So, you need to define the following tags:

Code:

ID => $in{'ID'},
user => $rec{'Contact Name'}


in the sub site_html_mailer_form routine.

Use the following hidden fields in your mailer_form.html file:

Code:

<input type="hidden" name="ID" value="<%ID%>">
<input type="hidden" name="user" value="<%user%>">


You can also print the contact name with the <%user%> tag.

Then in the sub site_html_mailer_failure define the following tags:

Code:

ID => $in{'ID'}


Then use the following hidden fields in the mailer_error.html file:

Code:

<input type="hidden" name="ID" value="<%ID%>">
<input type="hidden" name="user" value="<%user%>">


You can use <%user%> in this template file and in the mailer_success.html file.

If these tips do not help you, then I don't know what to tell you because I have given you all the codes I am using AND this script WAS originally WRITTEN for the MAIN links database.

Wink

Regards,

Eliot Lee
Quote Reply
Re: mailer In reply to
Hmm.....20/20 vision here......I must have overlooked it. It would be nice if an ID doesn't exist to go to the error page....I've got that nasty white CGI ERROR page that basically gives all the server variables and paths! Not a big deal...it will only come up if someone enters an ID in the location bar. I did notice, that it's not writing anything to the mailerlog.txt file though?? Permissions are right, file location is right? Does your work?

Quote Reply
Re: mailer In reply to
Yep...you sure did overlook it! Wink

For the CGI Error....

Replace &cgierr in the sub main routine with &site_html_mailer_failure. I have customized my sub cgierr routine in the db_utils.pl that ONLY includes the pertinent error message along with a one click button to notify me that there is an error.

Go to:

http://vlib.anthrotech.com/bin/mailer.cgi?ID=23

And you will see what I mean.

For the mailer file, you DO need to define the following variable in the links.cfg file:

Code:

$db_mailer_log = "$db_script_path/data/mailerlog.txt";


AS clearing stated in the README file. And then you have to put that file in the data directory and then change the permission of the file to 666 (rw-rw-rw-).

I have deleted the logging option since messages are already stored in the mailer.log ($db_mailer_log) file that stores all out-going messages. The only reason I included the logging routine is for people that want to keep better track of correspondences outgoing from the mailer.cgi file. (And for those more savvy programmer, you could easily view the mailer.log file in the mailer.cgi and other scripts like sendmail.cgi to track correspondences and use log results as another weighting factor for sections of your Links site, like Site of the Month Awards.)

Good luck finding a solution if this message does not help!

Wink

Regards,

Eliot Lee