Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfschedule not sending email

Guest
May 30, 2012 May 30, 2012

Hi all, I did a test setting the cfschedule startdate and starttime, I split up the query and cfmail to seperate pages as investigating cfschedule it appears that is what I need to do: http://forums.adobe.com/thread/446604 but nothing happened. Will this not happen automatically? Why did it not work? (cfmail and the query are correct) Thanks

mailp.cfm

<cfschedule action="Update"
task="testone"
operation="HTTPRequest"
url="http://www.mydomain.com/protect/actmail.cfm"
startdate="05/30/2012"
starttime="15:30:00"
interval="ONCE"
resolveurl="No"
publish="No">

qry_mailer.cfm

<cfquery name="qNames" datasource="salesdb">
select * from company, industries, division
where Date(company.meeting) = '2012-05-30'
and company.SECTORS1 = industries.SECTORSIDS
and division.DEPARTMENTIDS = company.DEPARTMENT1
ORDER BY company</cfquery>

actmail.cfm

<cfmail to="barney@bedrock.com"
from="barney@bedrock.com"
subject="Email test"
type="html">
<cfloop  query = "qNames">
#qNames.departmentnom#<br>
#qNames.phone#<br>
</cfloop>

1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 30, 2012 May 30, 2012

Looking at the code, it looks to be scheduled at 03:30 p.m. Have you checked to see if it's scheduled in the administrator? If so, (depending on your local time) it may not have ran yet. I tested locally just now and it appeared to execute just fine when I scheduled it to run at 01:30 p.m.

You can always put a try / catch block around your mail statement to see if it's tossing any errors.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 31, 2012 May 31, 2012

Hi

Its good to publish the output to a file and check. Hence you will be able to know the issue as well. you can use the code like as follows

<cfschedule action="Update"

task="testone"

operation="HTTPRequest"

url="http://www.mydomain.com/protect/actmail.cfm"

startdate="05/30/2012"

starttime="15:30:00"

interval="ONCE"

resolveurl="No"

publish = "Yes"

file = "sample.html"

path = "c:\inetpub\wwwroot\mysite\"

>

BTW is your site requires authenticaion say for example , if it requires credentilas to view http://www.mydomain.com/protect/actmail.cfm then you may need to provide that too.
Please let me know

Regards

Sreekar

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 31, 2012 May 31, 2012

Thanks for the help Sreekar, it is difficult because the hosts are the only ones with access to the admin to schedule, I have moved the cfm file to a non protected part of my site and they have setup a schedule so I'll see if it works.

I am confused as to if I set a time and date in cfschedule does that mean that it is overridden by the schedule in the admin? How does that work? Thanks again

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 01, 2012 Jun 01, 2012

Don't you actually have to include the query? I was thinking of something like this:

actmail.cfm

<cfinclude template="qry_mailer.cfm">

<cfmail>

</cfmail>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 02, 2012 Jun 02, 2012

Hi well they setup a schedule in the admin and it worked calling the mailp.cfm and sending the email. But now I don't understand why I even need cfschedule as I had a completely different date and time in the tag! The test by the hosts was yesterday but the startdate I have in the code was two days ago so I have no idea why it worked.

Thanks for the answer BKBK I have this code at the moment, I am including the qry_mailer.cfm in the main page at the moment, it seems to be "working" as such but I will try what you suggest.

mailp.cfm (the page that is setup in the admin for the schedule)

<cfinclude template = 'qry_mailer.cfm'>


<cfschedule action="Update"
task="testone"
operation="HTTPRequest"
url="actmail.cfm"
startdate="05/31/2012"
starttime="15:54:00"
interval="DAILY"
resolveurl="No"
publish="No">


<cfoutput><h1 style="color:red;">Today's action date: #DateFormat(qNames.meeting,"yyyy-mm-dd")#</h1></strong></cfoutput>

<cfoutput query="qNames"><strong>Company name: #company#</strong>
Sector: #sectorsnom#<br></cfoutput>

actmail.cfm

<cfquery name="qNames" datasource="salesdb">
select * from company, industries, division
where Date(company.meeting) = '2012-05-29'
and company.SECTORS1 = industries.SECTORSIDS
and division.DEPARTMENTIDS = company.DEPARTMENT1
ORDER BY company</cfquery>

<cfmail to="barney@bedrock.com"
from="wilma@bedrock.com"
subject="#DateFormat(qNames.meeting,"yyyy-mm-dd")#"
type="html">

<cfloop  query = "qNames">
<strong>Company name: #qNames.company#</strong><br>
Sector: #qNames.sectorsnom#<br>
</cfloop>
</cfmail>

qry_mailer.cfm

<cfquery name="qNames" datasource="salesdb">

select * from company, industries, division

where Date(company.meeting) = '2012-05-29'

and company.SECTORS1 = industries.SECTORSIDS

and division.DEPARTMENTIDS = company.DEPARTMENT1

ORDER BY company</cfquery>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 02, 2012 Jun 02, 2012
LATEST

goodychurro1 wrote:

... I have this code at the moment, I am including the qry_mailer.cfm in the main page at the moment, it seems to be "working" as such...

That's all right, then. You know what they say, "If it ain't broke,..."

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources