473,378 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to schedule a email generation task.

Hi,

This is an intranet. I wrote an ASP page to display a list of expired tasks. There is a form in this ASP page to send email notification to people who have expried tasks.

Now I want to the email to be automatically generated, by scheduled task or a trigger.

However, I do not know how to do it from here? I was told that I needed to write a script. Please help.
Jan 28 '09 #1
8 3759
The ASP script include an emailincl.asp and global.asa.
Jan 28 '09 #2
jhardman
3,406 Expert 2GB
ASP is great for writing tasks that will fire when someone visits a webpage, but to schedule a task they don't work so well. You can use a related scripting technology, Windows Scripts (also using VBScript as the language) to schedule tasks. We have decided to leave those questions in this forum, but I'm not really an expert. Let me think if I can remember which of our users are experts at Windows Scripts.

Jared
Jan 28 '09 #3
NeoPa
32,556 Expert Mod 16PB
I am no expert at Windows Scripting Host work, although I have managed to get a few things to work from time to time.

Let me have a look at this for you and see if I can at least work out a basic outline for you.

I'm afraid I'm not very ASP literate though so I do need to as is this process something that you wish to run as a scheduled task on the server or on the client?

Scheduling is a whole different ball-game of course, but I've done a little work there too so we'll see what can be managed.
Jan 29 '09 #4
Thanks jhardman and NeoPa.
After some research, I have tried to write the asp into vbscirpt and windows script file. then use Task Scheduler to run the script. However both of them did not work.

file1: testing.vbs
Expand|Select|Wrap|Line Numbers
  1. <!--#include file="emailincl.asp" -->
  2. 'document.write("Hello from VBScript!")
  3. dim counter
  4. counter= 0
  5. dim subject
  6. dim message_text
  7.  
  8. Set conn = CreateObject("ADODB.Connection")
  9. Set rs = CreateObject("ADODB.Recordset")
  10. conn.Open "Driver={SQL Native Client};Server=cslproxy;database=project_management;Trusted_Connection=yes;"
  11.  
  12. sql="select * from task_days when project=7"
  13. rs.open sql, conn 
  14. Do while not rs.eof 
  15. message_text= "This task will be due in the following date"
  16. message_text= message_text & vbcrlf & "Due Date: " & rs("task_due")
  17. message_text= message_text & vbcrlf & "Desctiption: " & rs("description")
  18. message_text= message_text & vbcrlf & "Assign: " & rs("assign")
  19. subject= "Task is due in " & rs("days_left") & " days"
  20.  
  21. email_team rs("project"),subject,message_text
  22. rs.movenext
  23. counter = counter + 1
  24. Loop 
  25. rs.close
  26. conn.close
  27.  

file2: ws_include.wsf
Expand|Select|Wrap|Line Numbers
  1. <job id="includeEmail">
  2.  <script src="emailincl.asp" language="VBScript"/>
  3.   <script language="VBScript">
  4.   dim counter
  5.   counter= 0
  6.  dim subject
  7.  dim message_text
  8.  
  9.   Set conn = CreateObject("ADODB.Connection")
  10.   Set rs = CreateObject("ADODB.Recordset")
  11.   conn.Open  "Driver={SQL Native Client};Server=cslproxy;database=project_management;Trusted_Connection=yes;"
  12.  
  13.    sql="select * from task_days when project=7"
  14.   rs.open sql, conn 
  15.   Do while not rs.eof 
  16.    message_text= "This task will be due in the following date"
  17.    message_text= message_text & vbcrlf & "Due Date: " & rs("task_due")
  18.    message_text= message_text & vbcrlf & "Desctiption: " & rs("description")
  19.    message_text= message_text & vbcrlf & "Assign: " & rs("assign")
  20.    subject= "Task is due in " & rs("days_left") & " days"
  21.  
  22.    email_team rs("project"),subject,message_text
  23.    rs.movenext
  24.    counter = counter + 1
  25.   Loop  
  26.   rs.close
  27.   conn.close
  28.  </script>
  29. </job>
  30.  
Jan 29 '09 #5
NeoPa
32,556 Expert Mod 16PB
OK. Let's see what we can do with this then.

Let's try to be specific and precise though, as otherwise we'll waste lots of time confusing each other.
  1. Let's start with the scheduling.
    When should it be scheduled?
  2. The code.
    You say it doesn't work. What does that mean? What can you tell me about what it does or doesn't do that will take us towards understanding what is going wrong?
You should understand, that from my experience with the WSH (Windows Scripting Host), it is probably the least friendly debugging environment of anything I've seen in many years.

We may well have to write our own debugging info out in the code. It is therefore critically important that we know at all times what we think we know. We will need to focus on particular areas of code at any time so we need to know what of the rest we really can rely on.
Jan 29 '09 #6
Hi NeoPa,

1. Both are scheduled to run in the next 10minutes to test if it send an email to my and two outlook account. The schedule will stop running if it runs for 10 minutes.

2. I did not receive any emails as I did with the .asp version of the script (which was with form and button)

The following code should call the include file emailincl.asp
Expand|Select|Wrap|Line Numbers
  1. email_team rs("project"),subject,message_text 
  2.  
My working asp file:
Expand|Select|Wrap|Line Numbers
  1. <!--#include file="emailincl.asp" -->
  2. 'html..........etc
  3.  
  4.  
  5. dim counter
  6. counter= 0
  7. dim a
  8.  
  9. 'ADO Connection...........
  10. 'Recordset.....etc
  11. 'Open database.....etc
  12.  
  13. sql="select * from task_days where project=7"
  14.   rs.open sql, conn 
  15.  
  16. 'a= total count of the sql above
  17.  
  18. if request("task")="add" then
  19.  dim subject 
  20.  'need another counter to start from 0
  21.  dim count
  22.  count = 0
  23.  
  24.  Do while count < a
  25.    subject= "Task is due in " & request("days_left_"&count) & " days"
  26.    message_text="This task will be due in the following date: " & request("task_due_"&count)
  27.    message_text=message_text & vbcrlf & "Desctiption: " & request("description_"&count)
  28.    message_text=message_text & vbcrlf & "Assign To: " & request("assign_"&count)
  29.    message_text=message_text & vbcrlf & "Please update the status if this task is completed"
  30.  
  31.    email_team request("project_"&count),subject,message_text
  32.    count = count + 1
  33.  Loop
  34.    response.write vbcrlf & "<br>" & a & "Email submitted."  
  35. else
  36.  
  37.    response.write vbcrlf & "<form action='task_notice2.asp' method='post'>"
  38.    response.write vbcrlf & "<input type=hidden name='task' value='add'>"
  39.  
  40. 'Table header and columns
  41.  
  42.   Do while not rs.eof        
  43.        'Display the recordset from database
  44.    rs.movenext
  45.    counter = counter + 1
  46.   Loop  
  47.     response.write vbcrlf & "</table>"
  48.     response.write vbcrlf & "<input type=submit name=a value='Click'></form>"  
  49.  
  50. rs.close
  51. conn.close
  52. End if
  53.  
Jan 30 '09 #7
NeoPa
32,556 Expert Mod 16PB
I'm sorry Yimma. I don't think I can really help here without spending much more time and effort than I have available.

This appears to be designing a whole (pretty complicated) script from scratch. I can handle some basics, but what you have at the moment is not trivial, but it's not a script either. It's in ASP (which I have no experience in whatsoever). The scheduling job alone, as it is now-relative (not a particular time of day but a time relative to the now of when it's run) is complex enough. I may be able to manage it if tasked with the job, but leading someone else through it at a distance (no way I can test it) would not be practicable.

It is therefore with regret that I must admit that I cannot help you on this one.
Feb 16 '09 #8
No problems. will do more research.
Feb 17 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Stephen | last post by:
Hi All, I'm trying to find a way where I can schedule a task to be run within a web site, either in VB (COM) or within the web site (ASP). What I want to do is to run a daily scheduled task...
0
by: cyshao | last post by:
Hi, My Friends: I have a program and I want to let machine automaticly auto it by using Windows task schedule. Sure, I can manually Create/Modify task in Windows task schedule. But I also hope...
19
by: n0sPaM | last post by:
Is it possible to schedule an .ASPX page to run automatically, say every hour? N.B.
1
by: Nick | last post by:
Hi I have created a VB .NET application which emails all staff in the office. I would like it to run every morning at 8am. I thought that the best way to schedule this would be through Windows...
23
by: pamelafluente | last post by:
Hi guys! I want to do a large number of scheduled task (say 80). Each task can be run at a certain time every given weekday. For instance at 10am and 5pm on each monday, etc. I would like to...
7
by: hgirma | last post by:
Hello Gurus, Is it possible to schedule a task to run an application deployed using ClickOnce? The executable changes location with each update.. and if i were to run the executable directly,...
3
by: BLUE | last post by:
I've to call 2 web method from time to time so that the web service will do cleanup and sync jobs on a database. These methods can be called once every X days where X >= Y for the sync method...
0
by: amduke | last post by:
Hello, I'm using the Microsoft Scheduler to schedule 6 access application. Each application is scheduled on a different time starting at 03:00 am and the last one is scheduled 07:30 am. The...
1
by: boanet | last post by:
I am trying to produce a scheduling form and having trouble figuring out how to approach it. Any advice would be great. Basically I created a form showing a list of tasks that need to be completed....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.