Skip to main content
January 25, 2013
Question

cfmail: attach file with cfmailparam?

  • January 25, 2013
  • 1 reply
  • 1282 views

Greetings

I created a form several years ago that allows users to submit maintenance requests. They check a box if they want a receipt sent to their own email.

The requests do not get captured in a DB- simply sends to email.

This all has been working fine- I am now attemping to add document attachment capability- I am obviously not using the correct method.

The form itself has:

<cfform action="request_action.cfm" method="post" name="detail" id="detail" enctype="multipart/form-data">

etc. etc.

Upload File or Sceenshot if neccessary: <cfinput name="file_upload" type="File" required="no" size="40"></cfform>

The request_action.cfm has:

<cfmail to=

etc. etc.

<cfif isDefined("Form.file_upload") >

    <cfmailparam 

        contentID = "file_upload"

        disposition = "attachment"

        file = "#Form.file_upload#" 

        type ="application/msword,application/docx,application/pdf,application/octet-stream,application/msword,text/plain,binary/octet-stream, image/pjpeg,  image/gif, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-word.document.12, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"></cfif>

</cfmail>

When I run without the above code, everything works. When I run with the cfmailparam, it sends a strange receipt with no content?

Thanks for any help with this

Norman

This topic has been closed for replies.

1 reply

Inspiring
January 26, 2013

You didn't post any code that shows that you actually uploaded the file to your server.