Gossamer Forum
Home : Products : DBMan : Installation :

Problem With "Email This" Mod

(Page 1 of 2)
> >
Quote Reply
Problem With "Email This" Mod
Hey there,

I've got the "Email this record to a friend" mod all setup on my DB, its the mod found here:

http://www.jpdeni.com/...Mods/send_record.txt

Everything seems to work, all the pages load correctly and I havn't ran across any errors, but the email never really gets there...anyone have any idea what the problem is?

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
Check the value in the $mailprog variable in the default.cfg file.

Make sure that you are using the correct path to your sendmail program in your server. If you do not have access to sendmail, then you need to use SMTP codes.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Problem With "Email This" Mod In reply to
Eliot,

Thanks, it sends the email alright, but I've come across another problem...

...the email thats sent contains the message I've typed in...but I guess I was assuming it could also contain the text for/a link to the record...am I doing something wrong, or do I need to add something to get this to happen? Smile

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
What do you have and what do you want?


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





Quote Reply
Re: Problem With "Email This" Mod In reply to
JPDeni,

You really aim to please, don't you? Smile

Right now when you fill out the "Email this Record" form it sends just fine, both email fields come out okay, and so does the subject...and so does the messages you send to your friend...

...what I'd like (if its reasonable) is to have a link to that record accompany the messages you send to your friend...as in:

"Check out this article:

http://linkgoeshere"

That would be a result of me typing my message as "Check out this article:"

It'd also be cool to just have certain form fields of the record in the email instead of the link, both methods achieve a similar result.

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
Chris:

Within the sub send_record { in your db.cgi file you can include a list of the fields you wish to include within the email sent.

Just list the fields within the

$mailtext = qq|
|;

section. Keep each field on a separate line or you can use /n for line breaks. You can also use /t for tabs.

Hope this helps Smile
Quote Reply
Re: Problem With "Email This" Mod In reply to
JPDeni,

I couldn't find any "$mailtext = qq|
|;" line in my db.cgi file or my html.pl file Frown
Quote Reply
Re: Problem With "Email This" Mod In reply to
In sub html_forward_email_form, just after

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

add

$in{$db_key} =~ s/<?.B>//g;

What's happening is that your "bold" tags are getting in the way of the script locating the correct record.



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






Quote Reply
Re: Problem With "Email This" Mod In reply to
Sorry when I referred to

$mailtext = qq| |;"

I thought you were using this version of Mail Record to a Friend.

http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000413.html

I should have checked the link of the mod you were using to see it was the Forward Record mod.

Again sorry for the confusion Smile
Quote Reply
Re: Problem With "Email This" Mod In reply to
JPDeni,

I inserted that line of code, but it still doesn't work...

I don't remember putting any bold tags in really, and I can take them out if it'll help...but I have no idea where I may have put them! Smile

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
Hi,

I'm sure of it now...I look all around for bold tags but didn't find any in a row like that or any of them anywhere near the links...

...the links that arn't working are on the "long" record display...the "Email the Author" links is okay, but not the "Email a Record" link...do you guys needs me to post some of my files in a viewable directory?

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
Hey,

It turns out the bold tags are in the URL on both the Email the Author and the Email-This-To-A-Friend pages...but I still don't know why, I've looked all through my html.pl file!

Any help would be VERY appreciated, this is the last bug I've got to work out for these mods! Smile

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
You can fix it really quickly by setting

$db_bold = 0;

in your .cfg file.

Or you can add the line I gave you earlier to all of the subroutines that print out the pages for the mod.

(Sorry I was late with this. I had errands to run today. Smile )


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






Quote Reply
Re: Problem With "Email This" Mod In reply to
JPDeni,

No apology needed! I set that variable to "0"...but I still get the same thing, it just sends the message, but no record accompanies it...do I just need to insert some code to tell it to add certain records after the message? I don't think I see any code like that right now...

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
At the beginning of

sub html_forward_email_form {

there is the following code:

Code:
foreach $col (@db_cols) {
$in{'email_message'} .= "$col: $rec{$col}\n";
}

What this is supposed to do is to put a list of the field names and the values of the fields for the record into a variable called $in{'emailmessage'}.

In the form, there is the following:

Code:
<td><textarea name="emailmessage" cols=40 rows=10 wrap="virtual">
$in{'emailmessage'}</textarea></td></tr>

This is supposed to take whatever was in the variable $in{'emailmessage'} and put it into the textarea on the form.

Do the values and fieldnames show up in the form?


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








[This message has been edited by JPDeni (edited April 06, 2000).]
Quote Reply
Re: Problem With "Email This" Mod In reply to
Think the problem may be due to two lines which may need to be changed in the original.

sub html_forward_email_form {
#--------------------------------------------
my ($message) = $_[0];
$in{$db_key} =~ s/<?.B>//g;
%rec = &get_record($in{$db_key});

# unless ($in{'email_message'}) {

change to:

unless ($in{'emailmessage'}) {

foreach $col (@db_cols) {

# $in{'email_message'} .= "$col: $rec{$col}\n";

change to:

$in{'emailmessage'} .= "$col: $rec{$col}\n";

Noticed these changes in another thread regarding this mod.

Hope this helps Smile
Quote Reply
Re: Problem With "Email This" Mod In reply to
JPDeni,

My code looks exactly the same in those areas...I'm not sure though, is it supposed to or not? Smile

Sorry, Lois, I don't really understand that...it says "change to" twice, but there are only three bits of code...?

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
Chris:

You will notice that two of the lines have:

email_message

they should be: emailmessage

Sorry I commented out the original lines so you would see what was currently there and then just put change to: underneath.

I think if you change from email_message to emailmessage in those lines it will make the mod work.

See this thread:

http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/001336.html
Quote Reply
Re: Problem With "Email This" Mod In reply to
Lois,

It works, thanks so much! The text for the article is in the "message" field when it loads! Smile

One thing though...is it possible to only include certain fields? And perhaps put line breaks inbetween each field? Smile

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
Thank you, Lois, for mentioning that. I didn't notice the difference in the variables myself, until Chris asked about it. I've fixed it in the mod. (Actually, I changed the variable name in the textarea, but the effect is the same.)

Chris, you can certainly only have certain fields print out.

Instead of

Code:
foreach $col (@db_cols) {
$in{'emailmessage'} .= "$col: $rec{$col}\n";
}

Go through and list the fields you want to include.

For example, if you wanted to include the fields named 'Name of Aricle' and 'Current Date', you would use

Code:
$in('emailmessage'} .= "$rec{'Name of Article'}\n";
$in('emailmessage'} .= "$rec{'Current Date'}\n";

The \n part of the line gives you a linebreak in the textarea field.

Notice the use of .=. This causes the text that your adding to be added to the end of whatever was previously in the variable.




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






Quote Reply
Re: Problem With "Email This" Mod In reply to
JPDeni,

I don't quite understand, what does this replace?

Code:

$in('emailmessage'} .= "$rec{'Name of Article'}\n";
$in('emailmessage'} .= "$rec{'Current Date'}\n";

I made sure the field names matched up and I replace this bit of code with it (in the sub html_forward_email_form subroutine):

Code:

$in{'emailmessage'} .= "$col: $rec{$col}\n";

But I got a syntax error...

Any ideas?

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
If you want to list all of the field names and values, use

Code:
foreach $col (@db_cols) {
$in{'emailmessage'} .= "$col: $rec{$col}\n";
}

If you only want some of the values to print out, for each one that you want to print, use

Code:
$in('emailmessage'} .= "$rec{'Name of Article'}\n";
$in('emailmessage'} .= "$rec{'Current Date'}\n";

I'm not quite sure what you replaced. If you're still getting a syntax error, I'll need to see the whole subroutine. Can you put it on the web where I can take a look at it?


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






Quote Reply
Re: Problem With "Email This" Mod In reply to
JPDeni,

Here ya go!

http://www.warningtrack.net/html_pl.txt

Chris
Quote Reply
Re: Problem With "Email This" Mod In reply to
If you only want a couple of the fields to print out, replace:

Code:
unless ($in{'emailmessage'}) {
foreach $col (@db_cols) {
$in{'emailmessage'} .= "$col: $rec{$col}\n";
}
}

with

Code:
unless ($in{'emailmessage'}) {
$in('emailmessage'} .= "$rec{'Name of Article'}\n";
$in('emailmessage'} .= "$rec{'Current Date'}\n";
}

You may have taken out too much or not enough of the old code, which could cause a syntax error.

If you still get a syntax error, please post the whole error message. There's sometimes information there that I can use.


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






Quote Reply
Re: Problem With "Email This" Mod In reply to
JP,

I did what you said, here's the error I got:


Code:
CGI ERROR
==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: syntax error at ./html.pl line 591, near "$in("
syntax error at ./html.pl line 592, near "$in("

Script Location : /usr6/home/warningt/public_html/cgi-bin/articles/db.cgi
Perl Version : 5.00503
Setup File : default.cfg

Any ideas? Smile

Chris

> >