Solved

CFcatch isn't working for null email values

Posted on 2006-07-07
9
331 Views
Last Modified: 2013-12-24
Our company requires new candidates for positions to fill out an application that is attached to certain jobs.  There is one field that asks for an email address however it is not required to enter a value.

When someone does enter their email address the application works fine however if you leave it null.  You get the following error message

The following information is meant for the website developer for debugging purposes. Error Occurred While Processing Request
> Attribute validation error for tag CFMAIL.       
> The value of the attribute TO is invalid. The length of the string, 0 character(s), must be greater than or equal to 1 character(s).             
>             
> The error occurred in C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\CustomTags\ct_dohistory.cfm: line 136 Called from C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\CustomTags\ct_dohistory.cfm: line 74 Called from C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\CustomTags\ct_dohistory.cfm: line 48 Called from C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\CustomTags\ct_dohistory.cfm: line 1 Called from C:\Inetpub\wwwroot\RecruitMax\Candidates\docandidateaddupdate.cfm: line 1547 Called from C:\Inetpub\wwwroot\RecruitMax\Candidates\docandidateaddupdate.cfm: line 1512 Called from C:\Inetpub\wwwroot\RecruitMax\Candidates\docandidateaddupdate.cfm: line 1473 Called from C:\Inetpub\wwwroot\RecruitMax\Candidates\docandidateaddupdate.cfm: line 908 Called from C:\Inetpub\wwwroot\RecruitMax\Candidates\docandidateaddupdate.cfm: line 893 Called from C:\Inetpub\wwwroot\RecruitMax\Candidates\docandidateaddupdate.cfm: line 1             
> 134 :  <cfset tEmail = attributes.AppMainEmail> 135 : </cfif> 136 : <cfmail query="GetCandidates" FROM="#tEmail#" TO="#Email#" SUBJECT="#GetEmailTemplate.SubjectLine#"> 137 : #Evaluate(NEWLETTER)#    138 : </cfmail>            



There is a <cfcatch> tag that is supposed catch emails for situations like this but it doesn't work for some reason like it used to.  

Also, I would i need to mention there were a couple of things I had done before all this was created

1.  Our company upgraded from CFMX to CFMX7

2.  The original problem to this was "Trying to find out why certain data was updating in one table but not the others.

3.  To resolve the problem to comment #2 I deleted these non-negotiable questions from the database and then I commented out the code that was used to insert these non-negotiable questions into the questionnaires.

From what it looks like whether I want it to or not a candidate has to enter a value into the email form field.  So at least one value gets passed.  Does anyone have any suggestions?
0
Comment
Question by:rudodoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 4

Expert Comment

by:CodeParadise
ID: 17063589
I think it has to done with the #Email# variable being null. Check to see that it is assigned a valid email address.

If that doesn't solve it, could you post a portion of your code?
0
 

Author Comment

by:rudodoo
ID: 17063686
I am going through it but where exactly do you thing the value for #Email# would be
0
 

Author Comment

by:rudodoo
ID: 17063837
ok, according to the code the assigned email address is valid using a cfparam tag and assigning it a default value but this is the testing servers and would that even be a factore
0
Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

 

Author Comment

by:rudodoo
ID: 17063864
I tested and my error message still pops up what portion of the code do you need to see
0
 
LVL 4

Expert Comment

by:CodeParadise
ID: 17064054
I guess we could try with the code leading up to the <cfmail> along with the <cftry> and <cfcatch>.
0
 

Author Comment

by:rudodoo
ID: 17064204
Ok, what is happening is that there is <cfmail> <Cftry> and <cfcatch> tags inserted in to the code but for some reason its  not reading them.  Here is the code.  Also keep in mind this used to work.  

<!--- Send E-Mail for New Externals --->
                                          <cfquery name="email" datasource="#DSN#">
                                                Select email from Candidates
                                                Where CandidateID = '#Val(tCandidateID)#'
                                          </cfquery>
                                          <cfquery name="jobtitle" datasource="#DSN#">
                                                Select jobtitle from Orders
                                                Where OrderID = '#szOrderID#'
                                          </cfquery>
                                          <cftry>
                                          <cfmail to="#email.email#" from="corp.staffing@Company.com" subject="REQUISITION #szOrderID# - #jobtitle.jobtitle#">


This message is to confirm that Company has received your application for requisition #szOrderID# - #jobtitle.jobtitle#.
                  
Company has retained the services of Company Background America (Company) as a background screening vendor.  As a result, you may be directed to their web site and asked to provide additional information.  This information is kept confidential by Company, and is not accessible by Company or any other organization.  Furthermore, information furnished to Company will be used only if an offer of employment is extended to you.
                  
Please continue to visit us frequently as our job site is updated daily with new opportunities.  Thanks again for exploring employment with Company!
                                          </cfmail>
                                           <cfcatch type="any">
                                          </cfcatch>
                                          </cftry>
                        <cfelse>
                              <cftry>
                              <!--- Send an email to the administrator advising that there was not Candidate Applied history category --->
                              <!--- to use for this workgroup so no history will show up for this candidate --->
                               <cfmail FROM="#DSN#"
                                          TO="#DSN#"
                                          SUBJECT="Unable to create candidate history">
                                          The candidate history could not be created for #GetCandidate.FirstName# #GetCandidate.LastName#
                                          because there was no History Category marked for New Web Candidates.
                              </cfmail>
                              <cfcatch type="any">
                              </cfcatch>
                              </cftry>
                        </cfif>
                  </cfif>
            </cfif>
      </cfif
0
 

Author Comment

by:rudodoo
ID: 17065220
Is it possible to insert an 'if' statement that tells coldfusion to use the same <cfcatch> tag if the value in the email is null
0
 
LVL 12

Expert Comment

by:mmc98dl1
ID: 17070630
the error is on line 136 <cfmail query="GetCandidates" FROM="#tEmail#" TO="#Email#" SUBJECT="#GetEmailTemplate.SubjectLine#">

So the error is caused by attributes.AppMainEmail being null. Where is this coming from?
0
 
LVL 4

Accepted Solution

by:
CodeParadise earned 500 total points
ID: 17077045
rudodoo,

I was able to recreate your error and I still believe that is has to do with the #Email# variable being null. If you want a null email value to be caught with your <cfcatch> then use the following inside your <cftry> tags and before your <cfmail> tags.


<cfif email EQ "">
    <cfthrow type="any">
</cfif>
0

Featured Post

Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
wordpress limitations 4 147
LAMP problem identifier tool ? 9 133
How to install a renewed SSL certificate on Windows 2012 server 7 147
Company website 6 65
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question