我有一個CF計劃任務,通過電子郵件發送給管理員用戶的電話摘要。我想添加爲某些管理員用戶發送報告的功能。附加報告對於每個管理員用戶都是動態的,並存儲在一個表中。我不能只是報告代碼,因爲它可能會改變或不存在爲下一個用戶。也許我應該使用CFHTTP,但我不熟練。從計劃任務內的coldfusion cfhttp帖子
<cfloop query="qGetTelemateEmails">
<cfif trim(QGetTime.Call_Email_On_Hour) eq "" or listfind(#QGetTime.Call_Email_On_Hour#,datepart("h",now()))>
<cfset TotalTime = 0>
<cfset NumberOfCalls = 0>
<cfmail ........></cfmail>
以下代碼是我想通過電子郵件發送報告的地方。
<cfquery name="QAdditionalReports" datasource="#request.dtsrc#">
Select *
From Admin_Telemate_Additional_Query_Daily as a LEFT OUTER JOIN
Admin_Users AS C ON A.AdminID = C.adminID LEFT OUTER JOIN
Admin_Telemate_Available_Queries AS b ON A.description = b.description
where a.adminid = #val(QGetTime.call_admin_user_id)#
</cfquery>
<cfif QAdditionalReports.recordcount gt 0>
SEE CODE BELOW -------------------------------------------------------------
</cfif>
</cfif>
</cfloop>
這是我想「包含/執行」的報告代碼。我從查詢表條目中獲取代碼的URL。
<cfquery name="QGetCommEct" datasource="#request.dsn#">
select *
from Q_ES_Communications_by_Search_Number
where upper(communication_type) = 'T'
and Date_Entered = '#dateformat(now(),"yyyy/mm/dd")#'
and consultant_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.adminid#">
order by date_Entered
</cfquery>
<cfmail>
<div style="text-align:center; font-weight:bold; ">Communications Files Query</div>
<table>
<tr>
<td>
<table style="font:Arial, Helvetica, sans-serif x-small; border:1px solid black; ">
<tr>
<td><strong>Type</strong></td>
<td><strong>Cons</strong></td>
<td><strong>Last Name</strong></td>
</tr>
<cfoutput query="QGetCommEct">
<tr valign="top">
<td>#QGetCommEct.Communication_Type#-#QGetCommEct.Category#</td>
<td>#QGetCommEct.AS400_Initials#</td>
<td>#QGetCommEct.lastname#</td>
</tr>
</cfoutput>
</table>
</td>
</tr>
</table>
</cfmail>
我更換了CFIF QAdditionalReports.recordcount GT 0與
<cfloop query="QAdditionalReports">
<cfhttp url="#QAdditionalReports.QueryURL##QAdditionalReports.QueryName#?adminid=#val(QGetTime.call_admin_user_id)#&emailto=#qGetTelemateEmails.Telemate_Email#">
<cfmail to="[email protected]" from="[email protected]" subject="Recap of daily phone calls" type="html" spoolenable="false"><cfdump var="#cfhttp#"></cfmail>
</cfloop>
和電子郵件包含;
struct
Charset [empty string]
ErrorDetail [empty string]
Filecontent [empty string]
Header HTTP/1.1 503 Server Error Content-Type: text/html Date: Wed, 13 Feb 2013 15:11:17 GMT Server: Microsoft-IIS/7.0
Mimetype text/html
Responseheader struct
Content-Type text/html
Date Wed, 13 Feb 2013 15:11:17 GMT
Explanation Server Error
Http_Version HTTP/1.1
Server Microsoft-IIS/7.0
Status_Code 503
Statuscode 503 Server Error
Text YES
這可能是因爲我需要做的HTTPS
有什麼問題嗎? – 2013-02-13 04:25:23
'cfhttp'非常簡單。看看文檔 - http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_g-h_09.html – 2013-02-13 04:26:36
我沒有看到cfhttp進入這個等式的位置。 – Travis 2013-02-13 14:13:05