Home : Products : DBMan : Customization :

Products: DBMan: Customization: Re: [omegadm] auto archive: Edit Log

Here is the list of edits for this post
Re: [omegadm] auto archive
OK final mod for this...

I wish to email the owners of each record that gets auto-archived. I have made the following changes:

if ( $today > $expiry_date) {
# next if statement retreives the email address from the db
# the number in {} must match the number in the .cfg file
# data separator is '|' in this case but could use $db_delim
if ($_ =~ /(.*\|){10}(.+\@.+)$/){
$record_email = $2;
$record_email =~ s/\@/\\\@/;
&mail_owner($record_email);
}
print ARC $_, "\n";
$count_archive++;
} else {
print DB $_, "\n";
}


New sub routine
# Mail archiving to record owner
sub mail_owner{
local ($record_email) = @_;
$todaybc = &get_date;
open (MAIL, "$mailprog") || &cgierr( "Can't open mail program!\n");
print MAIL "To: $record_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $html_title: Record Archived\n\n";
print MAIL "On date: $todaybc\n";
print MAIL "A record from your account has been archived from the database as it is older than $stay_alive days.\n\n";
print MAIL "Regards, \n$html_title Database Administrator.\n Email = >$record_email<\n";
close (MAIL);
}


However no mail comes through to the owner - the apache error_log file shows there is a bad header in the to: field when calling sendmail.

If I fix as:
print MAIL "To: webmaster\@omegadm.co.uk\n";

It works - email is sent with the last line "Email = " correctly set as the owner of the record e.g. owner\@omegadm.co.uk!!

Can anyone please help me with the syntax for this?

Last edited by:

omegadm: May 29, 2002, 12:57 PM

Edit Log: