Okay...actually, since you want the email to be sent to users when they add and modify links, you will need to edit the
admin_html.pl file and the
db.pl file.
Try the following:
1) Edit the
sub validate_records in the
db.pl file.
Find the following codes:
Code:
if ($db_email_modify) {
ID: foreach $id (keys %modify_list) {
if ($modify_list{$id}) { next ID; }
elsif (${$links{$id}}{'Contact Email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ | |
${$links{$id}}{'Contact Email'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}
else { &html_modify_email (%{$links{$id}}); }
}
}
if ($db_email_add) {
ID: foreach $id (keys %validate_list) {
if ($validate_list{$id}) { next ID; }
elsif (${$links{$id}}{'Contact Email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ | |
${$links{$id}}{'Contact Email'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}
else { &html_validate_email (%{$links{$id}}); }
}
}
Replace them with the following:
Code:
if ($db_email_modify) {
ID: foreach $id (keys %modify_list) {
if ($modify_list{$id}) { next ID; }
elsif (${$links{$id}}{'Contact Email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ | |
${$links{$id}}{'Contact Email'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}
elsif (${$links{$id}}{'SecondEmail'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ | |
${$links{$id}}{'SecondEmail'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}
else { &html_modify_email (%{$links{$id}});
if ($($links{$id}){'SecondEmail'}) {
&html_modify_second_email (%{$links{id}});
}
}
}
}
if ($db_email_add) {
ID: foreach $id (keys %validate_list) {
if ($validate_list{$id}) { next ID; }
elsif (${$links{$id}}{'Contact Email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ | |
${$links{$id}}{'Contact Email'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}
elsif (${$links{$id}}{'SecondEmail'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ | |
${$links{$id}}{'SecondEmail'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}
else { &html_validate_email (%{$links{$id}});
if ($($links{$id}){'SecondEmail'}) {
&html_validate_second_email (%{$links{id}});
}
}
}
}
Notice the bolded codes...these are new and edited codes. Also you will have to change the
'SecondEmail' with the field name of your second email address.
2) Create the following new sub-routines in your
admin_html.pl file:
sub html_modify_second_email Code:
sub html_modify_second_email {
# --------------------------------------------------------
# All the link information is stored in %link.
my (%link) = @_;
# Set the to, from, subject and message to send.
my $to = $link{'SecondEmail'};
my $from = $db_admin_email;
my $subject = "Your link has been added!";
my $msg = &load_template ('email-mod.txt', \%link);
# 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
&cgierr("Unable to init mailer! Reason: $Mailer::error");
$mailer->send or &cgierr ("Unable to send modification message. Reason: $Mailer::error");
}
AND
sub html_validate_second_email Code:
sub html_validate_email {
# --------------------------------------------------------
# All the link information is stored in %link.
my (%link) = @_;
# Set the to, from, subject and message to send.
my $to = $link{'SecondEmail'};
my $from = $db_admin_email;
my $subject = "Your link has been added!";
my $msg = &load_template ('email-add.txt', \%link);
# 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
&cgierr("Unable to init mailer! Reason: $Mailer::error");
$mailer->send or &cgierr ("Unable to send addition message. Reason: $Mailer::error");
}
Again, Change
SecondEmail with the second email address field name in your
links.def file.
Hope this works and helps.
BTW: Remember to bookmark this Thread, so that you can refer to it later.
Regards,
------------------
Eliot Lee Anthro TECH,L.L.C
www.anthrotech.com * Be sure to visit the
Resource Center for
FAQ's,
Modifications and
Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------