Now to the problem. I am reviewing the report from the code compatibility analyzer (cca) in order to migrate a site to CFMX. One of the items marked as an error by the cca report was the use of cfregistry.
The code identified is being used to resend emails. The cca error message indicates that CFREGISTRY should not be used on Windows servers. Is there another way to resend unsuccessful emails? Below is the error message given by the cca report along with an example of the current code being used.
CCA Error Message:
CFREGISTRY is deprecated in UNIX versions of ColdFusion MX. In Windows, you should not use CFREGISTRY to read ColdFusion server settings, because much of this information is no longer stored in the registry, or it is in a different location in the registry. The ColdFusion-related values that are stored in the registry are subject to change.
Current Code:
<!--- get the undelivr folder from the ColdFusion settings (The Registry) --->
<cfregistry action="GET" branch="HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\Mail" entry="BaseDirectory" variable="strMailPath" type="String">
<cfregistry action="GET" branch="HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\Mail" entry="BaseDirectory" variable="strMailPath" type="String">
<!--- get all the files inside that folder except for the . .. --->
<cfdirectory action="LIST" directory="#strMailPath#\undelivr" name="Undeliv">
<!--- if there are any files, move them --->
<cfif Undeliv.RecordCount GT 2>
<cfloop query="Undeliv">
<cfif Undeliv.Name is not "." and Undeliv.name is not ".." and Undeliv.Type is "File">
<cffile action="MOVE" source="#strMailPath#\undelivr\#Undeliv.Name#" destination="#strMailPath#\spool\">
</cfif>
</cfif>
The code identified is being used to resend emails. The cca error message indicates that CFREGISTRY should not be used on Windows servers. Is there another way to resend unsuccessful emails? Below is the error message given by the cca report along with an example of the current code being used.
CCA Error Message:
CFREGISTRY is deprecated in UNIX versions of ColdFusion MX. In Windows, you should not use CFREGISTRY to read ColdFusion server settings, because much of this information is no longer stored in the registry, or it is in a different location in the registry. The ColdFusion-related values that are stored in the registry are subject to change.
Current Code:
<!--- get the undelivr folder from the ColdFusion settings (The Registry) --->
<cfregistry action="GET" branch="HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\Mail" entry="BaseDirectory" variable="strMailPath" type="String">
<cfregistry action="GET" branch="HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\Mail" entry="BaseDirectory" variable="strMailPath" type="String">
<!--- get all the files inside that folder except for the . .. --->
<cfdirectory action="LIST" directory="#strMailPath#\undelivr" name="Undeliv">
<!--- if there are any files, move them --->
<cfif Undeliv.RecordCount GT 2>
<cfloop query="Undeliv">
<cfif Undeliv.Name is not "." and Undeliv.name is not ".." and Undeliv.Type is "File">
<cffile action="MOVE" source="#strMailPath#\undelivr\#Undeliv.Name#" destination="#strMailPath#\spool\">
</cfif>
</cfif>