Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically sent email

Status
Not open for further replies.

amillia

Programmer
Nov 14, 2001
124
US
Does any one know how to automatically send an email on a certain day of the week without using the coldfusion administrator. I need a report sent from a database on Monday morning the first time a user logs in and if no one works on monday i need the email sent on a tuesday. can anyone help me?
 
Hi,

How about putting in your script:

<cfif DayofWeek(Now) eq 2> ....2 means Monday

...do <cfmail processing here>

</cfif>

The syntax of DayofWeek is:

DayofWeek(&quot;date&quot;) where this function returns the ordinal for the day of the week as an integer in the range 1(Sunday) to 7(Saturday).

Hope this helps.
scripter73


Change Your Thinking, Change Your Life.
 
You also don't need access to CF Administrator to set up a scheduled task in ColdFusion.

You can simply use the CFSCHEDULE tag, which does the same thing as if you were sitting at the Administrator adding a task, but you can do it from any .cfm template you like (as long as it's enabled... it is by default).

So you'd set up a .cfm page that sends the email you want (say, mytask.cfm), then you create another .cfm page (say, scheduletask.cfm) that calls CFSCHEDULE with the URL of that first template ( in the URL attribute, plus whatever interval you like, etc. Bring up that second page in your browser, and the scheduled task will be added (then you can go ahead and delete the second page - scheduletask.cfm - you don't need it anymore). mytask.cfm will now be automatically fired at whatever interval you designated.



-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top