danarashad
Programmer
I am having trouble using the cfmail tag, for some reason it is sending 2 emails. It works great on my development server which is coldfusion 5, but on my prod server it sends 2 emails. I have posted some code, and anyone shed any light on what the problem is.
Thanks in advanced
<cfif isdefined('fs') and fs is 4 and form.show_name EQ "1. College Course Graduate Level" or fs is 4 and form.show_name is "2. College Course Undergraduate Level"
or fs is 4 and form.show_name is "8. Approved State/National committees"
or fs is 4 and form.show_name is "13. Attendance at approved state/national conventions clincs or conference"
or fs is 4 and form.show_name is "14. State or National officer in approved professional organizations">
<cfupdate datasource="#datasource#" tablename="proff" formfields="name, date1, userID, assignment, school, show_name,show_trait, show_report, des, location, goal, pre_reg, reg1, trans1, lodging1, other1, total1, pre_reg2,
reg3, checknum, date6, po, budget, hours, points, app, date7, principal, denied, tent, points2, supper, date2, one, two, three, four, five, comments, hours2, app2, date4, pointsappr, personnel, activity_name, date5">
<cfquery name="stupendousCheckQRY"datasource="#datasource#">
select rec_id from formApprasialStateP
where teacherID=#sid# and teacherStatus = 3 and appraiserStatus=3 and semesterID=#trim(form.semCode)# <cfif isdefined('formID')>
</cfif>
</cfquery>
<cfif stupendousCheckQRY.recordCount gt 0>
<cflocation url="index.cfm?sec=#sec#">
</cfif>
<cfscript>
form.form_id=#rec_id#;
form.jobID=#trim(form.jobID)#;
form.keyName=10;
form.teacherID=#session.auth.userID#;
form.teacherStatus=2;
form.appraiserStatus=1;
form.cycle=#tdc#;
form.cycleYear=#ty#;
form.status=#status#;
form.saved=2;
form.teacherDate=#now()#;
semesterID=#trim(form.semCode)#;
</cfscript>
<cfquery name="AppraisalStateCheckQRY" datasource="#datasource#">
select rec_id from formApprasialStateP
where teacherID=#sid# and semesterID=#trim(form.semCode)# and form_id=#trim(form.form_id)# <cfif isdefined('formID')>and rec_id=#trim(form.formID)#</cfif>
</cfquery>
<cfif AppraisalStateCheckQRY.recordCount is 0>
<cfquery name="AppraisalStateCheckQRY" datasource="#datasource#">
select rec_id from formApprasialStateP
where jobID=#trim(form.jobID)# and semesterID=#trim(form.semCode)# and form_id=#trim(form.form_id)#
</cfquery>
<cfset tempRecID=AppraisalStateCheckQRY.rec_id>
<cfelse>
<cfset form.rec_id=AppraisalStateCheckQRY.rec_id>
<cfupdate datasource="#datasource#" tablename="formApprasialStateP" formfields="teacherID, form_id, teacherStatus, appraiserStatus, cycle, cycleYear, saved, teacherDate, semesterID, status">
<cfset tempRecID=AppraisalStateCheckQRY.rec_id>
</cfif>
<cfquery name="appraiserCheck" datasource="#datasource#">
select myAppraiser, myAltAppraiser from demographics where id=#session.auth.userID#
</cfquery>
<cfif appraiserCheck.myAppraiser GT 0>
<cfset thisAppraiserCheck=appraiserCheck.myAppraiser>
<cfelseif appraiserCheck.myAltAppraiser gt 0>
<cfset thisAppraiserCheck=appraiserCheck.myAltAppraiser>
<cfelse>
<cfset thisAppraiserCheck=0>
</cfif>
<cfquery name="toEmailQRY" datasource="#datasource#">
select username from demographics where id=#thisAppraiserCheck#
</cfquery>
<cfquery name="fromEmailQRY" datasource="#datasource#">
select username, fName, lName from demographics where id=#session.auth.userID#</cfquery>
<cfquery name="formName" datasource="#datasource#">
select formName from formName where keyName=10
</cfquery>
<!-- email get sent to HR -->
<!--- We do not want ColdFusion to suppress whitespace here --->
<CFPROCESSINGDIRECTIVE SUPPRESSWHITESPACE="No">
<CFMAIL
SUBJECT="#emailsubject#"
FROM="#fromEmail#"
TO="#toemail#"
SERVER="#mailserver#"
>
has completed the #emailSubject#.
Please login to the system and respond.
#emailNotificationLink#
#messageForm#
</CFMAIL>
</CFPROCESSINGDIRECTIVE>
<cflocation url="index.cfm?sec=#sec#">
</cfif>
<!-- end of email -->
Thanks in advanced
<cfif isdefined('fs') and fs is 4 and form.show_name EQ "1. College Course Graduate Level" or fs is 4 and form.show_name is "2. College Course Undergraduate Level"
or fs is 4 and form.show_name is "8. Approved State/National committees"
or fs is 4 and form.show_name is "13. Attendance at approved state/national conventions clincs or conference"
or fs is 4 and form.show_name is "14. State or National officer in approved professional organizations">
<cfupdate datasource="#datasource#" tablename="proff" formfields="name, date1, userID, assignment, school, show_name,show_trait, show_report, des, location, goal, pre_reg, reg1, trans1, lodging1, other1, total1, pre_reg2,
reg3, checknum, date6, po, budget, hours, points, app, date7, principal, denied, tent, points2, supper, date2, one, two, three, four, five, comments, hours2, app2, date4, pointsappr, personnel, activity_name, date5">
<cfquery name="stupendousCheckQRY"datasource="#datasource#">
select rec_id from formApprasialStateP
where teacherID=#sid# and teacherStatus = 3 and appraiserStatus=3 and semesterID=#trim(form.semCode)# <cfif isdefined('formID')>
</cfif>
</cfquery>
<cfif stupendousCheckQRY.recordCount gt 0>
<cflocation url="index.cfm?sec=#sec#">
</cfif>
<cfscript>
form.form_id=#rec_id#;
form.jobID=#trim(form.jobID)#;
form.keyName=10;
form.teacherID=#session.auth.userID#;
form.teacherStatus=2;
form.appraiserStatus=1;
form.cycle=#tdc#;
form.cycleYear=#ty#;
form.status=#status#;
form.saved=2;
form.teacherDate=#now()#;
semesterID=#trim(form.semCode)#;
</cfscript>
<cfquery name="AppraisalStateCheckQRY" datasource="#datasource#">
select rec_id from formApprasialStateP
where teacherID=#sid# and semesterID=#trim(form.semCode)# and form_id=#trim(form.form_id)# <cfif isdefined('formID')>and rec_id=#trim(form.formID)#</cfif>
</cfquery>
<cfif AppraisalStateCheckQRY.recordCount is 0>
<cfquery name="AppraisalStateCheckQRY" datasource="#datasource#">
select rec_id from formApprasialStateP
where jobID=#trim(form.jobID)# and semesterID=#trim(form.semCode)# and form_id=#trim(form.form_id)#
</cfquery>
<cfset tempRecID=AppraisalStateCheckQRY.rec_id>
<cfelse>
<cfset form.rec_id=AppraisalStateCheckQRY.rec_id>
<cfupdate datasource="#datasource#" tablename="formApprasialStateP" formfields="teacherID, form_id, teacherStatus, appraiserStatus, cycle, cycleYear, saved, teacherDate, semesterID, status">
<cfset tempRecID=AppraisalStateCheckQRY.rec_id>
</cfif>
<cfquery name="appraiserCheck" datasource="#datasource#">
select myAppraiser, myAltAppraiser from demographics where id=#session.auth.userID#
</cfquery>
<cfif appraiserCheck.myAppraiser GT 0>
<cfset thisAppraiserCheck=appraiserCheck.myAppraiser>
<cfelseif appraiserCheck.myAltAppraiser gt 0>
<cfset thisAppraiserCheck=appraiserCheck.myAltAppraiser>
<cfelse>
<cfset thisAppraiserCheck=0>
</cfif>
<cfquery name="toEmailQRY" datasource="#datasource#">
select username from demographics where id=#thisAppraiserCheck#
</cfquery>
<cfquery name="fromEmailQRY" datasource="#datasource#">
select username, fName, lName from demographics where id=#session.auth.userID#</cfquery>
<cfquery name="formName" datasource="#datasource#">
select formName from formName where keyName=10
</cfquery>
<!-- email get sent to HR -->
<!--- We do not want ColdFusion to suppress whitespace here --->
<CFPROCESSINGDIRECTIVE SUPPRESSWHITESPACE="No">
<CFMAIL
SUBJECT="#emailsubject#"
FROM="#fromEmail#"
TO="#toemail#"
SERVER="#mailserver#"
>
has completed the #emailSubject#.
Please login to the system and respond.
#emailNotificationLink#
#messageForm#
</CFMAIL>
</CFPROCESSINGDIRECTIVE>
<cflocation url="index.cfm?sec=#sec#">
</cfif>
<!-- end of email -->