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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoSend CFMAIL... 1

Status
Not open for further replies.

fusionaire

Programmer
May 20, 2000
67
0
0
US
Can you tell a CF server to automatically send emails on a certain date or time?
 
You can simply create a page that sends your email using CFMAIL and then setup a scheduled task in CF administrator to run your page at a certain time.<br><br>Hope this helps,<br><br>Bromrrr
 
If you don't have access to the CF Administrator, you can programmatically set up a scheduled task using CFSCHEDULE.&nbsp;&nbsp;If you need to do it this way, check your help system for proper syntax, or if you need help, just let me know here....<br><br>DM
 
DarkMan~<br>I would very much appreciate some inspiration on how to set up an automatic emailer with CF.<br><br>Thanks
 
Here's a quick script to welcome all new members to a site daily...<br><br>Set up a user table with email,username, password and joindate fields and a mailtracker table (to keep track of when these mails went out).<br><br>email.cfm<br>---------------------------------------------<FONT FACE=monospace><b><br>&lt;!--- get date of last mailing ---&gt;<br>&lt;cfquery name=&quot;lastmail&quot; datasource=&quot;mydb&quot;&gt;<br>&nbsp;&nbsp;select date from mailtracker<br>&lt;/cfquery&gt;<br><br>&lt;cfset maildate=now()&gt;<br><br>&lt;!--- get new member info ---&gt;<br>&lt;cfquery name=&quot;addresses&quot; datasource=&quot;mydb&quot;&gt;<br>&nbsp;&nbsp;select email, username, password from users<br>&nbsp;&nbsp;where joindate &gt; '#dateformat(lastmail.date)# #timeformat(lastmail.date)#'<br>&lt;/cfquery&gt;<br><br>&lt;!--- send mail ---&gt;<br>&lt;CFMAIL QUERY=&quot;addresses&quot; TO=&quot;email&quot; FROM=&quot;<A HREF="mailto:me@mysite.com">me@mysite.com</A>&quot; SUBJECT=&quot;Welcome to My Site!&quot; SERVER=&quot;mail.mysite.com&quot;&gt;Welcome to MySite.com!&nbsp;&nbsp;I hope you enjoy all your membership privileges.&nbsp;&nbsp;Remember, your username is #username# and your password is #password#.&lt;/CFMAIL&gt;<br><br>&lt;!--- confirm mail went out ---&gt;<br>&lt;CFMAIL TO=&quot;<A HREF="mailto:me@mysite.com">me@mysite.com</A>&quot; FROM=&quot;<A HREF="mailto:me@mysite.com">me@mysite.com</A>&quot; SUBJECT=&quot;Welcome to My Site! Confirmation&quot; SERVER=&quot;mail.mysite.com&quot;&gt;The &quot;Welcome to My Site!&quot; email went out to #addresses.recordcount# new members.&lt;/CFMAIL&gt;<br><br>&lt;!--- set mailtracker date to now ---&gt;<br>&lt;cfquery name=&quot;update&quot; datasource=&quot;mydb&quot;&gt;<br>&nbsp;&nbsp;update mailtracker set date='#dateformat(maildate)# #timeformat(maildate)#'<br>&lt;/cfquery&gt;<br></b></font><br><br><br>Now, if you have access to the ColdFusion Administrator, simply go to the Scheduled tasks area and put in the required information to set up a scheduled task.<br><br>If you don't have access, you can set up a file, like:<br><br>emailscheduler.cfm<br>----------------------------------<FONT FACE=monospace><b><br>&lt;CFSCHEDULE ACTION=&quot;UPDATE&quot; TASK=&quot;WelcomeEmail&quot;&nbsp;&nbsp;OPERATION=&quot;HTTPRequest&quot; URL=&quot;<A HREF=" TARGET="_new"> STARTDATE=&quot;7/12/2000&quot; STARTTIME=&quot;01:00&quot; INTERVAL=&quot;Daily&quot;&gt;<br>WelcomeEmail task set up...<br></font></b><br>Just run the emailscheduler.cfm file once and the scheduled task will run every day at 1:00am...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top