Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFMailparam Attachement not working

Status
Not open for further replies.

susanh

MIS
Jan 16, 2001
229
US
Hi Everyone,
I am trying to send an email with a pdf attachment, but I keep getting the following error message. I can figure out what i am doing wrong. I know it must be something simple (I hope!)

Error Message

Unable to attach file.

Cannot attach 'Cleveland Flipping Rules.pdf' to the mail message. The file does not exist.

The error occurred while processing an element with a general identifier of (CFMAIL), occupying document position (23:1) to (26:38).

Code Page
<CFIF #Form.Filename# IS NOT "">
<cffile action="UPLOAD"
filefield="Form.Filename"
destination="D:\inetpub\ Guidelines\ORTBulletins"
nameconflict="OVERWRITE">
<cfset Form.Filename = "#cffile.serverFile#">
<CFELSE>
<cfset Form.Filename = "NA">
</cfif>
<!---inserts bulletin file into ortbulletins table --->
<cfset Date = #CreateODBCDate(DateFormat(Now()))#>
<cfquery name="AddORT" datasource="underwriting" dbtype="ODBC">
INSERT INTO ORTBulletins(Name, Filename, BulletinDate, uploaded_date)
VALUES('#FORM.Name#', '#FORM.Filename#', '#FORM.BulletinDate#', #Date#)
</cfquery>
<cfmail
from = "patc@accudatasearch.com"
to = "susanh@accudatasearch.com"
subject = "Subject #Form.Name#">
<cfmailparam file = "#cffile.serverFile#">
</cfmail>
 
cfmailparam has to be the full path so maybe this will work

<cfmailparam file = "#cffile.serverDirectory##cffile.serverFile#">

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1959-2001)
 
have you confirmed that the file is being uploaded? at first glance, it looks like the line that reads:
Code:
<cffile action="UPLOAD"
        filefield="Form.Filename"
        destination="D:\inetpub\[URL unfurl="true"]wwwroot2\Title[/URL] Guidelines\ORTBulletins"
        nameconflict="OVERWRITE">

needs to have Form.Filename in #'s like:
Code:
<cffile action="UPLOAD"
        filefield="#Form.Filename#"
        destination="D:\inetpub\[URL unfurl="true"]wwwroot2\Title[/URL] Guidelines\ORTBulletins"
        nameconflict="OVERWRITE">

also, im not sure if you're uploading the docs to your web root, but you might want to use the full path in the cfmailparam tag like in this example from live docs:

Code:
<h3>cfmailparam Example</h3>
<p>This view-only example uses cfmailparam to attach files and add header to
   a message.</p>
<cfmail from = "peter@domain.com" To = "paul@domain.com" Subject = "See Important Attachments and Reply">
   <cfmailparam name = "Importance" value = "Hich">
   Please review the new logo. Tell us what you think.
   <cfmailparam file = "c:\work\readme.txt" type="text/plain">
   <cfmailparam file = "c:\work\logo.gif" type="image/gif">
</cfmail>
 
im sorry, my last post was incorrect, the cffile tag is ok as is
 
Thanks BombBoy,
I tried your suggestion and I got the following.
---------2181aaf2181aaf
Content-Type: application/pdf
Content-Disposition: attachment; filename="Code of Federal Regulations.pdf"
Content-Transfer-Encoding: base64

JVBERi0xLjQNJeLjz9MNCjI2IDAgb2JqIDw8L0xpbmVhcml6ZWQgMS9MIDUwNTc0OS9PIDI5L0UgMTAzOTMyL04gNi9UIDUwNTE4Mi9IIFsgNTM2IDE5OF0+Pg1lbmRvYmoNICAgICAgICAg........


I have also tried the full directory path and ColdFusion told me that it could not find the file. I am stumped.
 
D:\inetpub\ Guidelines\ORTBulletins\Code of Federal Regulations.pdf

gave you file not found but

#cffile.serverDirectory##cffile.serverFile#

gave you some crazy output?

both evaluate to be the same so they should have the same errors, it looks like it at least tried to send but hick-uped

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1959-2001)
 
I tried the full directory again and got the same kind if email.

I wonder if it my email system. We use Novell GroupWise.
 
That part is beyond me sorry. at least we found the file. :)

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1959-2001)
 
Hi again,
Well I tested in Outlook and Groupwise and received the same problem.

I also modified the tag to include "type="image/pdf" hoping that may resolve the issue.

I am just stumped.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top