duckiebear
Programmer
I want to modify a current subroutine to send an email to a user 14 days before their contract expiration date ends. I'm not exactly sure how to do this. I have some code to build from that I have tried to modify, but am really at a loss as to what it should really look like. Can anyone help?
Code:
[b]sub notify_users[/b]
local ($local_email_address, $local_comment, $local_mail_template, $local_url) = @_;
$notification_date = $expiration_date - 14)
if $current_date = $notification_date
foreach $email_address (split (/\:/, $local_email_address)) {
$pid_index++;
if ($email_address ne "none") {
$local_comment =~ s/\#//g;
`sed 's%<record_number>%${record_number%g;s#<company_name#${company_name}#g;s#<last_name>#${last_name#g;s#<expiration_date>#${expiration_date}#g;s#<comment>#g;s#<local_comment>#g;' $local_mail_template > /home/Mail/inbox/$$.${pid_index}.message_body`;
if (-z "/home/Mail/inbox/$$.${pid_index}.message_body) {
`echo "Email Address: $email_address\nRemote Address: $remote_addr\nProgram: contract_tracking.perl\nEmpty email message!" | /usr/sbin/SMIMail -s "No Internet Mailbox found" admin\@emailaddy.com`;
} else {
`echo "/home/Mail/inbox/$$.${pid_index}.message_body|Contract Tracking Notice|$email_address" > /home/Mail/inbox/$$.${pid_index}message_info`;
}
} else {
`echo "Email Address: $email_address\nRemote Address $remote_addr\nProgram: contract_tracking.perl\nNo internet mailbox found for: $email_address{$email_address} | /usr/sbin/SMIMail -s "No Internet Mailbox found" admin\@emailaddy.com`;
}
}
}