• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 395
  • Last Modified:

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>

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

<cfif trim(len(resume)) GT 4>
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.


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

<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#">

#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">

1 Solution
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.
semerjAuthor Commented:
no. all the other forms on the site work.
check your cfmail.log and see if theres an entry for it.  let's see if it's even trying to email it.
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

I do see one small error in the code above...

You are missing the opening "<" in the following code:  cfif cffile.serverfileext EQ "exe">
semerjAuthor Commented:
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?
semerjAuthor Commented:
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!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

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