|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello Everyone,
Im after a script.. or sub that will allow me to send mass email to a list of clients based on the date they ordered from us. I have the datbase an everything up and running. I just dont know how to go about adding this part of the script. I know theres proberly a simple solution but i just cant seem to get any thing working. Any ideas or urls to something similar would be greatly appreciated. Thanks for your time, Wazza |
|
#2
|
||||
|
||||
|
How is the date formatted?? How is the date stored, in a flat file, Mysql table,..etc..??? When is the email suppose to be sent, in relationship to the date,..30 days from the date, 7, 14 ....etc...
Are you using "sendmail" or SMTP mail server.... Need some additional details ![]() Mickalo
__________________
Thunder Rain Internet Publishing Custom Programming & Database development Providing Personal/Business Internet Solutions that work! |
|
#3
|
|||
|
|||
|
Hi Mickalo,
Here is my date sub..... sub system_date { my $time = shift; my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time; my @months = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!; $year = $year + 1900; return "$day-$months[$mon]-$year"; } Stored in a flat file database. And the email needs to be sent 14 days from the date ordered. And i am using sendmail. Cheers, Wazza |
|
#4
|
||||
|
||||
|
The date formatting your using, it would be very difficult to calculate the 14 day interval you need to trigger the email. This basically just creates a "pretty" date:
DD-MM-YYYY format The easiest way to do this is to use UNIX localtime(time) function, then you can create you base date/time, the calculate the 14 day interval from that. The date format your using now is a "string" type date, not actually a numerical type date, and very hard to do any sort of calculations unless you convert it back to either time() or localtime(time). Here's a little code snip used to calculate todays currect time and then calculate 14 interval: Code:
$offset = 336; # 14 days(in hrs days x 24) $offset_secs = ($offset*3600); # total secs(3600 equals 1 hr in secs) for 14days from todays date $time_a = time(); $time_b = ($time_a + $offset_secs); Now $time_a would equal todays date, and $time_b would equal 14 days for today. Now you have a numerical value to work with to do your calcuations. Hope this might help ![]() Mickalo |
|
#5
|
|||
|
|||
|
Hi Mickalo,
Thanks alot. Ill give it a go. ![]() Cheers, Wazza |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Sending email by date? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|