Hi Michael,

Thanks for the reply.

Two points I did not understand.

1. Why did we need a <cfset var 
accountCheck="">  on the CF side when there was a query named accountcheck as 

<cfquery datasource="#Application.ds#" name="accountCheck">
                    
SELECT email, fname, lname, 
password 
                    
FROM 
user_accounts
                    
WHERE email = '#form_data.email#<cfif form_data.email does not 
contain 
'@domain.com'>@domain.com</cfif>' 
                
</cfquery>


What was the reason for adding a variable accountCheck? Because in the if block 
in the CF side we are testing <cfif accountCheck.recordcount> which was based 
on the result of above query so is there any reason/purpose for setting 
accountCheck to empty string?

2. On the CF side cfmail is failing in the try block as there is no mail server 
so it was going to the catch block where no true/false was being returned so I 
got the message "Unable to invoke CFC  
recoverPassword as the return type is not boolean. I added a <cfreturn true 
/>  in the catch part and the error message disappeared. 

Since in the recoverPassword on the Flex side, the eventObj.result is not being 
modified in CFC  
recoverPassword it has value false and so we go into the else part where I get 
the message Alert.show(''The email address that you 
supplied was not found in our records.", 'Email Not Found');

I saw nothing was present in SpoolMail to. My intent was to test if the cfmail 
functionality works and if so the undelivered mails should be displayed using a 
SpoolMail, but they are not. How do I know now if the cfmail worked properly or 
not?

Can you please clarify?

Sorry, if my questions are naive, but I am pretty new to ColdFusion/Flex.

Thanks



________________________________
From: Michael Givens <[email protected]>
To: [email protected]
Sent: Wed, June 2, 2010 6:48:32 PM
Subject: Re: [AFFUG Discuss] Newbie questions on Flex for email notification 
and form review

 
Try this on the Flex-side (the modified CFC 
function [see below] returns a Boolean):
 
public function 
recoverPassword(eventObj:ResultEvent):void{
    
        
        
    if (eventObj.result){
                        
Alert.show(''Your credentials have been sent to the email address on 
file.', 'Password Recovery Confirmation');
    
                
    currentState = 
'';
            } else 
{
                
        Alert.show(''The email address that you 
supplied was not found in our records.', 'Email Not Found');
            }

}
 
On the CF-side:

<!--- Password 
Retrieval --->    
    <cffunction 
name="recoverPassword" access="remote" returntype="boolean">
       
 <cfargument name="form_data" type="struct">
    
    <cfset var 
accountCheck=""> 
       
        
<cftry>
                
<cfquery datasource="#Application.ds#" 
name="accountCheck">
                    
SELECT email, fname, lname, 
password 
                    
FROM 
user_accounts
                    
WHERE email = '#form_data.email#<cfif form_data.email does not contain 
'@domain.com'>@domain.com</cfif>' 
                
</cfquery>
                
                
<cfif 
accountCheck.recordcount>
                    
<cfmail from="[email protected]" to="#accountCheck.email#"  
subject="Credentials Request" 
type="html">
                        
Dear #accountCheck.fname# #accountCheck.lname#, <br /><br 
/>
                        
                        
You have requested that we send your login credentials for the system on 
#DateFormat(now(), 'MMMM 
DD,YYYY')#.
                        
<br /><br 
/>
                        
Your log-in information:<br 
/>
                        
<b>Email address:</b> #accountCheck.email#<br 
/>
                        
<b>Password:</b> 
#accountCheck.password#
                        
<br /><br 
/>
                        
                        
If you did not request your login credentials, please contact us immediately at 
<a 
href="mailto:[email protected]";>[email protected]</a>:
                        
<br /><br 
/>
                        
<span style="color:red; font-weight:bold; font-style:italic;">Please do 
not reply to this 
email</span>
                    
</cfmail> 
                   
                    <cfreturn true 
/>                    
                
<cfelse>
    
                <cfreturn 
false/>
                
</cfif>
            
           
            
            
<cfcatch>
                    
<cfsavecontent 
variable="contentSaver">
                       
                          
<cfdump 
var="#cfcatch#">
                    
</cfsavecontent>
                    
                    
<cffile action="write" file="#ExpandPath('.')#\debug.html" 
output="#contentSaver#">
            
</cfcatch>
        
</cftry>
    </cffunction>
 
----- Original Message ----- 
>From: Chris H 
>To: [email protected] 
>Sent: Thursday, June 03, 2010 3:19 
>  AM
>Subject: Re: [AFFUG Discuss] Newbie 
>  questions on Flex for email notification and form review
>
>
>Tom,
>
>Whenever my application tries to send a mail using the CFMAIL 
>  functionality it either crashes or no mails show up in 
>  SpoolMail.
>
>Before I installed SpoolMail, my Coldfusion/Flex application 
>  was crashing due to reference to a null object eventObj which made me think 
> that since I 
>  have no mail server installed, it is occurring when CFMAIL tries to send an 
>  email and posted here on May 26. 
>
>The application has a functionality 
>  something like the below for Recovering password function.
>
>User clicks 
>  a button in the Flex front end, enters his mail address, after which a 
>  function called recoverPassword is called in the "login.mxml" file which has 
>  code as 
>
>public function 
>  recoverPassword(eventObj:ResultEvent):void{
>    
>          
>    
>          if(eventObj.result.status == 
>  'true'){
>            
>              
>  Alert.show(eventObj.result.statusMsg, 'Password Recovery 
>  Confirmation');
>            
>              currentState = 
>  '';
>            
>          }
>    
>                  
>  else{
>            
>              
>  Alert.show(eventObj.result.errMsg, 'Email Not Found');
>    
>                  
>  }
>
>}
>
>In 
>  the ColdFusion component file, there is a function 
>
><!--- Password 
>  Retrieval --->    
>    <cffunction 
>  name="recoverPassword" access="remote" 
>  returntype="any">
>        <cfargument 
>  name="form_data" 
>  type="struct">
>        
> 
>        
>  <cftry>
>                
>  <cfquery datasource="#Application.ds#" 
>  name="accountCheck">
>                    
>  SELECT 
>  *
>                    
>  FROM 
>  user_accounts
>                    
>  WHERE email = '#form_data.email#<cfif form_data.email does not contain 
>  '@domain.com'>@domain.com</cfif>' 
> 
>                
>  </cfquery>
>                
> 
>                
>  <cfif 
>  accountCheck.recordcount>
>                    
>  <cfmail from="[email protected]" to="#accountCheck.email#"  
>  subject="Credentials Request" 
>  type="html">
>                        
>  Dear #accountCheck.fname# #accountCheck.lname#, <br /><br 
>  />
>                        
> 
>                        
>  You have requested that we send your login credentials for the system on 
>  #DateFormat(now(), 'MMMM 
>  DD,YYYY')#.
>                        
>  <br /><br 
>  />
>                        
>  Your log-in information:<br 
>  />
>                        
>  <b>Email address:</b> #accountCheck.email#<br 
>  />
>                        
>  <b>Password:</b> 
>  #accountCheck.password#
>                        
>  <br /><br 
>  />
>                        
> 
>                        
>  If you did not request your login credentials, please contact us immediately 
>  at <a 
>  href="mailto:[email protected]";>[email protected]</a>:
>                        
>  <br /><br 
>  />
>                        
>  <span style="color:red; font-weight:bold; font-style:italic;">Please do 
>  not reply to this 
>  email</span>
>                    
>  </cfmail> 
> 
>                   
> 
>                    
>  <cfset result['status'] = 
>  true>
>                    
>  <cfset result['statusMsg'] = 'Your credentials have been sent to the 
>  following email address: 
>  #accountCheck.email#'>
>                
>  <cfelse>
>                    
>  <cfset result['errMsg'] = 'The email address that you supplied was not 
>  found in our 
>  records.'>
>                    
>  <cfset result['status'] = 
>  false>
>                
>  </cfif>
>            
> 
>           
> 
>            
>  <cfreturn 
>  result>
>            
> 
>            
>  <cfcatch>
>                    
>  <cfsavecontent 
>  variable="contentSaver">
>                       
> 
>                          
>  <cfdump 
>  var="#cfcatch#">
>                    
>  </cfsavecontent>
>                    
> 
>                    
>  <cffile action="write" file="#ExpandPath('.')#\debug.html" 
>  output="#contentSaver#">
>            
>  </cfcatch>
>        
>  </cftry>
>    
>  </cffunction>
>     
>Before I installed 
>  SpoolMail the application crashed at public function 
>  recoverPassword(eventObj:ResultEvent):void as the eventObj was null so 
> trying 
>  to access eventObj.result.status 
>  resulted in an access violation.
>
>After I installed SpoolMail it is 
>  still crashing and nothing shows up in SpoolMail. I commented out the 
> function 
>  public function recoverPassword(eventObj:ResultEvent):void, but still 
> nothing 
>  shows up in SpoolMail.
>
>Am I missing something?
>
>Any advice would 
>  be appreciated?
>
>Thanks
>
>
>
________________________________
 From: Tom McNeer 
>  <[email protected]>
>To: >  [email protected]
>Sent: >  Wed, May 26, 2010 4:53:39 PM
>Subject: Re: [AFFUG Discuss] Newbie 
>  questions on Flex for email notification and form 
>  review
>
>Chris,
>
>
>
>On Wed, May 26, 2010 at 4:10 PM, Chris H <[email protected]> >  wrote:
>
>I tried Spoolmail, but could not see any section named Custom 
>>    Extensions in the ColdFusion Administrator in my browser(Firefox 3.6) 
>> after 
>>    I copied the Spoolmail files into the web root 
>>    at: /CFIDE/admistrator and creating the extensionscustom.cfm as explained 
>> in 
>>    the install.doc file.
>
>I'm afraid I have no way of knowing the problem. If the files are in 
>  the correct place, the "Custom Extensions" menu choice should be available 
> at 
>  the bottom of the left-hand menu in CF Admin. Clicking it will reveal the 
>  SpoolMail link.
> 
>In extensions section in the Coldfusion 
>>    administrator, all I see is Java Applets, CFX Tags, Custom Tag Paths, 
>> CORBA 
>>    Connectors
>>
>
>Yep. But that's the wrong place. The "Custom Extensions" choice is 
>  separate from "Extensions." It's probably the last choice in the left-hand 
>  menu.
>
>If you're certain that all files are correct, and in the correct 
>  place, I guess you could try restarting the CF service. The SpoolMail docs 
>  don't mention it, and I can't imagine why it should be necessary, but you 
>  could try it.
>
>I've installed SpoolMail on several machines. If it's set 
>  up correctly, it always works.
> 
>
>
>>Next, Spoolmail is used for reading 
>>    mail only meaning an email server is required for testing and Spoolmail 
>> will 
>>    be helpful in reading it? 
>>Or, is no mail server required if using 
>>    Spoolmail?
>>
>
>You don't need a mail server. The actual mail message is created and 
>  formatted properly by the CFMAIL functionality. If ColdFusion cannot connect 
>  to a mail server, it places the message in its "undelivered" folder. You can 
>  find it at {CFInstallDirectory}/Mail/Undelivr.
>
>SpoolMail just looks 
>  into this directory and displays what's there.
>
>
>-- 
>Thanks,
>
>Tom
>
>Tom 
>  McNeer
>MediumCool
>http://www.mediumcool.com
>1735 Johnson Road 
>  NE
>Atlanta, GA 
>  30306
>404.589.0560
>
>
>------------------------------------------------------------- 
> 
>To unsubscribe from this list, simply email the list with unsubscribe in 
>  the subject line 
>
>For more info, see http://www.affug.com 
>Archive @ http://www.mail-archive.com/discussion%40affug.com/ 
>List hosted by FusionLink 
>------------------------------------------------------------- 
>
------------------------------------------------------------- 
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line 

For more info, see http://www.affug.com 
Archive @ http://www.mail-archive.com/discussion%40affug.com/ 
List hosted by FusionLink 
------------------------------------------------------------- 


      


-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to