Gossamer Forum
Home : Products : Links 2.0 : Customization :

emailing link owners

Quote Reply
emailing link owners
I have been searching the forum to see if anyone had come up with a way of automating a mailing to link owners without much luck, anyone know of any ways.

Was thinking of doing a monthly mailing with their link stats etc.

Found one to automate subscriber newsletter but thats all so far.

Not having much luck. Anyone know any info?
Quote Reply
Re: [roman365] emailing link owners In reply to
The logic would apply for link owners...you'd have to use CRON (or Windows AT Scheduler) to schedule the script. In terms of pulling the link owners emails and their stats, you could look in the email.cgi (subscribe.cgi) and change the field references to the ones in link.db rather than email.db.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] emailing link owners In reply to
Youre basically suggesting reworking subscribe.cgi right?

Sounds good, I'll have a try. Just wondering though about testing it to get it right .... dont want to send loads of test emails to all my links ownersSmile
Quote Reply
Re: [roman365] emailing link owners In reply to
Hows this look so far?

Code:


#!/usr/bin/perl

# -------------

# Links

# -------------

# Links Manager

#

# File: subscribe.cgi

# Description: Adds a user to the mailing list.

# Author: Alex Krohn

# Email: alex@gossamer-threads.com

# Web: http://www.gossamer-threads.com/

# Version: 2.01

#

# (c) 1998 Gossamer Threads Inc.

#

# This script is not freeware! Please read the README for full details

# on registration and terms of use.

# =====================================================================

#

# Required Librariers

# --------------------------------------------------------

eval {

($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /

($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.

require "$db_lib_path/db_utils.pl";

require "$db_lib_path/links.def";

$build_use_templates ?

require "$db_lib_path/site_html_templates.pl" :

require "$db_lib_path/site_html.pl";

};

if ($@) {

print "Content-type: text/plain\n\n";

print "Error including libraries: $@\n";

print "Make sure they exist, permissions are set properly, and paths are set correctly.";

exit;

}

# ========================================================

eval { &main; }; # Trap any fatal errors so the program hopefully

if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.

exit; # There are only two exit calls in the script, here and in in &cgierr.

my %in = @_;

my $list = $db_links_name;



# Send an email to the link owner.

my $id = $in{ID'};

my $title = $in{'Title'};

my $date = $in{'Date'};

my $url = $in{'URL'};

my $category = $in{'Category'};

my $description = $in{'Description'};

my $name = $in{'Contact Name'};

# my $to = $in{'Contact Name'}; # commented out for testing

my $to = $db_admin_email;

my $from = $db_admin_email;

my $hits = $in{'Hits'};

my $isnew = $in{'isNew'};

my $ispopular = $in{'isPopular'};

my $rating = $in{Rating'};

my $votes = $in{'Votes'};

my $subject = "$build_site_title monthly stats update for $title";

my $msg = qq|Dear $name,

Here is your montly stats summary for your site link stored in our database

at $build_site_title :

Title : $title

Url : $URL

Description : $description

Contact Name : $name

Contact Email : $to

Category : $category

Category URL : $db_cgi_url/$category

$site_title Link : $db_cgi_url/jump.cgi?ID=$id

Since it was added on $date your site has accumulated $hits hits, and

currently has an average Vote rating of $rating for a total number of

$votes votes.



If you have any ideas, any comments or anything, please don't

hesitate to email.

Sincerely,

$build_site_master,

$db_admin_email

$build_site_title : $build_root_url

|;

# Then mail it away!

require "$db_lib_path/Mailer.pm";

my $mailer = new Mailer ( { smtp => $db_smtp_server,

sendmail => $db_mail_path,

from => $from,

subject => $subject,

to => $to,

msg => $msg,

log => $db_mailer_log

} ) or return;

$mailer->send or return;

sub get_users {

# -----------------------------------------------------------

# Returns a hash ref of a list of all users in a list.

#

my ($list) = shift;

my $users_r;

my $delim = quotemeta ($db_delim);

open (LIST, "<$list") or &cgierr ("Unable to open list: $config{'list_dir'}/$list. Reason: $!");

if ($db_use_flock) { flock (LIST, 1); }

while (<LIST>) {

chomp;

(/(.*)$delim(.*)/o) and (${$users_r}{$1} = $2);

}

close LIST;

return $users_r;

}



A bit stumped, would like to have if new and if popular references in the email but unsure how to go about it.
Quote Reply
Re: [roman365] emailing link owners In reply to
Im totally stuck, can anyone help?