Current location: Hot Scripts Forums » Programming Languages » Perl » using time as trigger in sending notification mail


using time as trigger in sending notification mail

Reply
  #1 (permalink)  
Old 07-08-04, 01:49 PM
abtimoteo abtimoteo is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Question using time as trigger in sending notification mail

hi, everybody!

how is time used to trigger the sending of an e-mail? you will find below a script that will send an e-mail if (a) var1 eq var2 and (b) once there is user action (e.g., a user clicking on a button to execute the script). but what if there is no user and there is only server-time as a trigger?

-----

# assume that $server_time is generated using "localtime (time)"
# while $expiration_date is user-defined and in the same
# format as $server_time.

if ($server_time eq $expiration_date) # change needed here to make time
{ # the trigger in sending a notification
open (M, "|/usr/sbin/sendmail -t"); # mail.

select (M);

print M "To: email\@client.com\n";
print M "From: email\@service_provider.com\n";
print M "Subject: expired subscription\n\n";

print M "your subscription has expired\n";

close (M);
}
Reply With Quote
  #2 (permalink)  
Old 07-09-04, 12:34 PM
Chas Chas is offline
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
Use cron

I would run this as a nightly (how ever often you need to run it) cron job.

cron tutorial

~Charlie

p.s.

Code:
if ($server_time eq $expiration_date) {...}
I'd be *very* surprised if you ever got that statement to trigger. I would leave the dates in unix timestamp format and do something like:

Code:
if (time > $exp_timestamp) {...}
of look into one, or more, of the Date::Calc functions.

~Charlie
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Error Fairnie PHP 8 06-26-04 07:15 AM
Limit the form submission according to time bionicsamir PHP 7 05-09-04 11:10 PM
time Alii Script Requests 2 03-20-04 11:31 AM
Reduce the time intensive phases of .Net application development using TierDeveloper3 smars General Advertisements 0 12-02-03 05:15 AM
Showing time is users time zone? Nasimov PHP 1 11-20-03 07:14 AM


All times are GMT -5. The time now is 03:57 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.