2 Replies Latest reply on May 13, 2008 6:41 AM by Dan Bracuk

    attaching file to email

    sirtcarlos Level 1
      i have a form that i require an individual to upload a file with. however, i am not putting the attachment in a db, i need it to simply attach to an html email message. i tried using:
      <cfif DirectoryExists( ExpandPath( ".\ResumeFolder\" ) )>
      <cffile action="upload"
      fileField="resume"
      destination="#GetTempDirectory()#"
      nameconflict="makeunique"
      accept="text/plain,application/msword,application/pdf,application/rtf">
      Cover Letter/Resume/Writing Sample: <cfmailparam file="#resume#" />
      <cfelse>
      <cfdirectory directory="#ExpandPath( ".\ResumeFolder\" )#" action="create">
      <cffile action="upload"
      fileField="resume"
      destination="#GetTempDirectory()#"
      nameconflict="makeunique"
      accept="text/plain,application/msword,application/pdf,application/rtf">
      Cover Letter/Resume/Writing Sample: <cfmailparam file="#resume#" />
      </cfif>

      however, sometimes the emails will be received on mac computers, sometimes on pc's. i need a method that will not require an absolute path to a folder on the hard drive. is it possible to simply attach a document to an email alone?
        • 1. Re: attaching file to email
          Level 7
          check cfmailparam tag in the docs.

          Azadi Saryev
          Sabai-dee.com
          http://www.sabai-dee.com/
          • 2. Re: attaching file to email
            Dan Bracuk Level 5
            quote:

            Originally posted by: sirtcarlos
            i have a form that i require an individual to upload a file with. however, i am not putting the attachment in a db, i need it to simply attach to an html email message. i tried using:
            <cfif DirectoryExists( ExpandPath( ".\ResumeFolder\" ) )>
            <cffile action="upload"
            fileField="resume"
            destination="#GetTempDirectory()#"
            nameconflict="makeunique"
            accept="text/plain,application/msword,application/pdf,application/rtf">
            Cover Letter/Resume/Writing Sample: <cfmailparam file="#resume#" />
            <cfelse>
            <cfdirectory directory="#ExpandPath( ".\ResumeFolder\" )#" action="create">
            <cffile action="upload"
            fileField="resume"
            destination="#GetTempDirectory()#"
            nameconflict="makeunique"
            accept="text/plain,application/msword,application/pdf,application/rtf">
            Cover Letter/Resume/Writing Sample: <cfmailparam file="#resume#" />
            </cfif>

            however, sometimes the emails will be received on mac computers, sometimes on pc's. i need a method that will not require an absolute path to a folder on the hard drive. is it possible to simply attach a document to an email alone?

            It doesn't matter what type of computer your mail recipients are using. All the directory stuff applies to your server.