Solved

CFMail problem

Posted on 2006-07-21
9
381 Views
Last Modified: 2013-12-24
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>
0
Comment
Question by:semerj
9 Comments
 
LVL 7

Expert Comment

by:aseusainc
Comment Utility
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.
0
 

Author Comment

by:semerj
Comment Utility
no. all the other forms on the site work.
0
 
LVL 7

Accepted Solution

by:
aseusainc earned 500 total points
Comment Utility
check your cfmail.log and see if theres an entry for it.  let's see if it's even trying to email it.
0
 
LVL 1

Expert Comment

by:aescribens
Comment Utility
I do see one small error in the code above...

You are missing the opening "<" in the following code:  cfif cffile.serverfileext EQ "exe">
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:semerj
Comment Utility
Copy and paste error. It is in the actualo code on the page.
0
 
LVL 5

Expert Comment

by:mrigsby
Comment Utility
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.
0
 
LVL 7

Expert Comment

by:aseusainc
Comment Utility
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?
0
 

Author Comment

by:semerj
Comment Utility
Kind of. Actually, I misnamed one of the form fields which resulted in the email field being blank and CF not sending the mail.
0
 
LVL 7

Expert Comment

by:aseusainc
Comment Utility
Thanks for the follow up!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Service "nameserver" appears to be down 4 474
External Wordpress Site loads very slow 1 247
Script 12 114
whm high memory usage in processes 7 33
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now