Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Pugdog's Recommend It

Quote Reply
Pugdog's Recommend It
I am using Pugdog's Recommend_It script, and it works great. I am, however, looking to add a modification that will e-mail me a confirmation of recommended links. We're just looking to audit the use of this feature.

I am assuming that I need to add something to sub send_sendmail in Mailer.pm.

I tried the following, but received a software error:

Code:
if ($self->{'subject'} eq 'Site Recommendation') {

open ($s, "|$self->{'sendmail'}");
print $s "To: ", $LINKS{db_admin_email}, "\n";
print $s "From: ", $self->{'from'}, "\n";
print $s "Reply-to: ", $self->{'reply'}, "\n" if self->{'reply'};
print $s $self->{'headers'}, "\n" if $self->{'headers'};
print $s "X-Mailer: Mailer::$VERSION (http://www.gossamer-threads.com/scripts/)\n";
print $s "Subject: ", $self->{'subject'}, "\n\n";
print $s $self->{'msg'};
close $s;
}
I put this in between the end of the primary mailing code and:L

Code:
$self->log_msg() or return undef;

return 1;
Can someone let me know what my problem is? :)

Thanks.

Quote Reply
Re: Pugdog's Recommend It In reply to
it's been awhile since I looked at it.

In the code,where the message is actually being printed out, you can probably add a line to the headers:

print $s "Bcc: ", $LINKS{db_admin_email} , "\n";


Check it out by sending yourself some mail at your regular EMAIL address, and seeing what the headers look like, and if you also get a message at the "admin" email address.

"Bcc" should _NOT_ appear in the headers -- it's a BLIND CARBON COPY.



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Pugdog's Recommend It In reply to
Duh, I should have thought of that. I added the following before the print "Subject..."

Code:
if ($self->{'subject'} eq 'hotHOCKEY Links: Site Referral') {
print $s "Bcc: ", $LINKS{db_admin_email}, "\n";
}


Quote Reply
Software Error In reply to
Pugdog (or anyone else),

When I add the Bcc tag to Mailer.pm as follows:

Code:
# Get a filehandle, and open pipe to sendmail.
my $s = &FileHandle::new('FileHandle');
open ($s, "|$self->{'sendmail'}");
print $s "To: ", $self->{'to'}, "\n";
print $s "From: ", $self->{'from'}, "\n";
print $s "Reply-to: ", $self->{'reply'}, "\n" if $self->{'reply'};

if ($self->{'subject'} eq 'hotHOCKEY Links: Site Referral') {
print $s "Bcc: ", $LINKS{db_admin_email}, "\n";
}

print $s $self->{'headers'}, "\n" if $self->{'headers'};
print $s "X-Mailer: gossamer-threads.com\n";
print $s "Subject: ", $self->{'subject'}, "\n\n";
print $s $self->{'msg'};
close $s;
$self->log_msg() or return undef;

return 1;
}
Everything seems to work fine with recommend_it.cgi. However, when I try to use add.cgi, I get a software error saying that the there was a problem accessing the mailer. Where the error occurs is at:

Code:
# Then mail it away!
require Links::Mailer;
$mailer = new Links::Mailer ( {
smtp => $LINKS{db_smtp_server},
sendmail => $LINKS{db_mail_path},
from => $from,
subject => $subject,
to => $to,
msg => $msg
} ) or die $Links::Mailer::error;
$mailer->send or die $Links::Mailer::error;
Any idea what is wrong?

Quote Reply
Re: Software Error In reply to
Two things to check:

1) check your error logs and see what they say.

2) remove the Bcc: line you added, and see if the error goes away.


I can' figure out why that would cause a problem, since there are no uninitialized variables, no missing packages, and everything is self contained.

let me know what you find out with #1 and #2.



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Software Error In reply to
Hey Pugdog,

1) Here is the error log:

[Wed Jul 26 14:28:48 2000] add.cgi: Global symbol "%LINKS" requires explicit package name at admin/Links/Mailer.pm line 230.
[Wed Jul 26 14:28:48 2000] add.cgi: Compilation failed in require at /usr/local/etc/httpd/vhosts/hothockey.com/cgi-bin/links/add.cgi line 174.

2) Everything works fine with the Bcc removed.

I appreciate the help.

Quote Reply
Re: Software Error In reply to
It's what I figured....

If you change the $LINKS{db_admin_email} to your actual email address, it will _probably_ work. "username\@domain.com"

Add.cgi is not passing the %LINKS hash for some reason. Why it doesn't, I don't know, but it's something I remember hitting before. See if it works when you use the direct email address.



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/