Link to home
Start Free TrialLog in
Avatar of semerj
semerj

asked on

CFMail problem

One of my forms on a website is not delivering results. The form submits fine. I have been over the code 100 times and can't find anything. All other forms on the site work.


<cfif trim(len(Email)) LT 1>
    You must provide an email address.<br>
    Use the back button in your browser to correct the problem.<br><br>
<cfabort>
</cfif>



<CFSET thisPath= ExpandPath("resumes/")>
<CFSET thisDirectory= GetDirectoryFromPath(thisPath)>

<cfif trim(len(resume)) GT 4>
<cffile
                        action="UPLOAD"
                        filefield="resume"
                        destination="#GetDirectoryFromPath(thisPath)#"
                        nameconflict="makeunique"
                        mode="777">
                        
                        
                  
cfif cffile.serverfileext EQ "exe">
               You are attempting to upload an executable file.<br><br>
                Please use the back button in the browser to upload a file that is not executable.


                        <cfabort>
</cfif>

<cfset resume='#File.ServerFile#'>
</cfif>


<cfmail to="#form.email#" from="#form.resumeemail#" subject="#form.subject#" type="html" bcc="caroline@advancedwebs.biz">

<cfif trim(len(form.resume)) GT 0>      
      <cfmailparam file="#GetDirectoryFromPath(thisPath)#/#resume#">
</cfif>

#form.subject# <br><br>
From job posting: #jobID#<br><br>
<cfloop index="thefield" list="#form.fieldnames#">
    <cfset fields="#thefield# = #evaluate(thefield)#">
    <CFIF #fields# contains "submit" or #fields# contains "required"
            OR #FIELDS# contains "recipient" or #fields# contains "subject"
            or #FIELDS# contains "redirect">

    <cfelse>
        #fields#<br>
    </cfif>
</cfloop>
</cfmail>
Avatar of aseusainc
aseusainc

The code looks fine.  Any restrictions on your SMTP server that might be denying this?  Instead of <cfmail>ing this, just <cfoutput>all the values and make sure you are getting what you expect to be getting.
Avatar of semerj

ASKER

no. all the other forms on the site work.
ASKER CERTIFIED SOLUTION
Avatar of aseusainc
aseusainc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I do see one small error in the code above...

You are missing the opening "<" in the following code:  cfif cffile.serverfileext EQ "exe">
Avatar of semerj

ASKER

Copy and paste error. It is in the actualo code on the page.
One thought I have is that by default CFMail spools these emails and I have had problems in the past with this (Especially with attachments as they tend to be lower priority). One thing you can try is to set the spoolenable="no" in the CFmail tag and possibly specify the server,username and password parameters to test it and see if that makes a difference.
Thanks for the points.  Guessing there was an issue with SMTP?  What was the final resolution to this, so that others might learn from it?
Avatar of semerj

ASKER

Kind of. Actually, I misnamed one of the form fields which resulted in the email field being blank and CF not sending the mail.
Thanks for the follow up!