[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 788
  • Last Modified:

Can't send email using cfc and <cfmail>

I have a flash movie calling this cfc. The insert the record into the database part works OK, but the <cfmail> does not. What's wrong?

<cffunction name="InsertNewComment" access="remote" returntype="string" hint="Add new comment">
            <!--- Define required parameters --->
            <cfargument name="FirstName" type="string" required="yes">
            <cfargument name="LastName"  type="string" required="yes">
            <cfargument name="Email"     type="string" required="yes">
            <cfargument name="Message"   type="string" required="yes">


            <!--- Insert new record into the Database --->

            <cfquery  datasource="boxoroxnet" username="boxoroxnet" password="Qm4ba27d">
            INSERT INTO email_ (FirstName, LastName, Email, Date, Message)
            VALUES('#FirstName#','#LastName#','#Email#',#Now()#,'#Message#')
                 </cfquery>
                  
           <cfmail
            from="info@lfoo.com"
            to="foo@foo.com"
            subject="Message">

      content here
            
      </cfmail>
       
     <!--- Specify result as string --->
      <cfset result="Thank you! You'll receive a response from fooFoo shortly.">
      <!--- Return result of the function --->
      <cfreturn result>
      </cffunction>
0
kabookis
Asked:
kabookis
  • 2
  • 2
1 Solution
 
PluckaCommented:
Well, since you haven't specified any servers. Is your mail server setup in ColdFusion administrator and does it verify?
0
 
PluckaCommented:
Also try checking the ColdFusion logs, as if this is getting an error you wont see it, but will see it in the logs.

C:\ColdFusion8\logs\
0
 
kabookisAuthor Commented:
Mail is set up in CF Admin. Other templates on this site are able to send email.

When I run the code

   <cfmail
            from="info@lfoo.com"
            to="foo@foo.com"
            subject="Message">

      content here
           
      </cfmail>

in a separate cf page (mail_test.cfm) in the same directory as the cfc, the email gets sent.

Using mail_test.cfm, the CF Admin mailsent.log reports Mail"Message sent from info@foo.com To; foo@foo.com was successfully sent using ..."

When I copy and paste the same code into the function, no email is sent.
mail.sent reports nothing, and mail.log reports no errors. The database insert always works, however.



0
 
kabookisAuthor Commented:
I figured it out the email problem, but I still don't get why it now works.  I changed the Flash Publish settings to "Access network only" and the entire cfc works. The form field info is inserted into the database, and the email is sent.


Why would having the Publish settings set at "Access local files only" allow a DB insert but not a <cfmail> tag?





0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now