1
我不是100%何時使用cfoutput以及如何在以下示例中使用cfoutput。整個cfmail應該包裝在cfoutput中嗎?關於什麼時候在cfmail中使用cfoutput的問題
背景:我有一個基於if語句發送電子郵件的函數。電子郵件的消息包含來自cfquery的變量。
<cffunction name="emailUpdate" access="public" returntype="string">
<cfargument name="usr_email" required="yes">
<cfargument name="status_update" required="yes">
<cfargument name="form_id" required="yes">
<cfquery name="emailformData" datasource="RC">
SELECT *
FROM Basic_Info
WHERE ID = <cfqueryparam value="#ARGUMENTS.form_id#">
</cfquery>
<cfoutput query="emailformData">
<cfmail
from="[email protected]"
to="#usr_email#"
subject="Status Update">
<cfif status_update EQ 'Submitted'>
Form Submitted: The following quote request ID: #emailformData.ID# has been submitted on
#emailformData.Submission_Date# for the following party #emailformData.Sold_to_Party#. You will receive automated
updates via email when your submission changes status. <b>- Admin Team</b>
<cfelseif status_update EQ 'Assigned'>
Form Assigned by Admin Request ID: #emailformData.ID# for the following party #emailformData.Sold_to_Party# was
assigned to Admin ID #emailformData.Admin_ID# on #DateFormat(Now())#, #TimeFormat(Now())#.
Below is their direct contact information for any change requests or status updates. <b>- Admin Team</b>
<cfelseif status_update EQ 'Returned'>
Returned by Admin Form ID: #emailformData.ID# for the following party #emailformData.Sold_to_Party# was
returned by Admin ID #emailformData.Admin_ID# on #DateFormat(Now())#, #TimeFormat(Now())#
for the following reasons. Admin Notes: #emailformData.Admin_Notes#.
<b>- Admin Team</b>
<cfelseif status_update EQ 'Completed'>
Form Completed Form ID: #emailformData.ID# for the following party #emailformData.Sold_to_Party# has been
marked as COMPLETED on #DateFormat(Now())#, #TimeFormat(Now())#. The following Quote Number has been
assigned to this form #emailformData.Quote_Num#. The quote will be emailed to you. If the Admin added any closing notes to the form they will appear below:
#emailformData.Admin_Notes#
<b>- RFQ Admin Team</b>
</cfif>
</cfmail>
</cfoutput>
</cffunction>
所以,我可以包住整個事情在?請參閱我對上述問題的編輯。謝謝您的幫助。 +1 –
Denoteone
你甚至不需要''......''標籤的行爲就像是''。如果您想根據查詢結果發送多封電子郵件,您可以執行'',但由於您的查詢看起來只返回1行,因此您無需這麼做無論是。 –
duncan
再次感謝您的信息。 – Denoteone