8 Replies Latest reply on Nov 6, 2006 6:18 PM by JLSF

    Send attachments with cfmail???

    JLSF
      Greetings!
      I'm in a pickle...I need to send out information to our list. It's long. I'd rather send a letter with CFMAIL and send the rest as a PDF attachment, but I don't know the coding and settings for attachments! :D

      Help?
      Many thanks!!!
        • 1. Re: Send attachments with cfmail???
          Level 7
          Check out the documentation for <cfmailparam ...> it gives a couple of
          examples.


          <h3>cfmailparam Examples</h3>
          <p>This view-only example uses cfmailparam to 1) add header to a message
          and 2) attach files and 3) to return a receipt to the sender.</p>

          <cfmail from = "peter@domain.com" To = "paul@domain.com" Subject = "See
          Important Attachments and Reply">
          <cfmailparam name = "Importance" value = "High">
          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">
          <cfmailparam name="Disposition-Notification-To" value="peter@domain.com">
          </cfmail>

          <p>This view-only example displays an image in the body of
          an HTML message.</p>

          <cfmail type="HTML"
          to = "#form.mailto#"
          from = "#form.mailFrom#"
          subject = "Sample inline image">
          <cfmailparam file="C:\Inetpub\wwwroot\web.gif"
          disposition="inline"
          contentID="image1">
          <P>There should be an image here</p>
          <img src="cid:image1">
          <p> After the picture</p>
          </cfmail>
          • 3. Re: Send attachments with cfmail???
            JLSF Level 1
            Mny thanks...but I get an error message:

            Security: The requested template has been denied access to (filename).pdf.
            The following is the internal exception message: access denied (java.io.FilePermission CONF06REGISTRATIONFORM.pdf read)

            with (filename) my change in the code for this posting.

            Is there something I'm missing?
            This is not a form/download of an attachment, but a newsletter we would send out to a list via a query of that list with an attachment.

            many thanks...

            • 4. Re: Send attachments with cfmail???
              Level 7
              The ColdFusion service user (default localSystem) must have permission
              to do anything with the file system or other resource. If the
              attachment was a local file on the server I would expect it to under the
              default permissions of the default localSystem user. But if any of the
              assumptions are incorrect it could cause a problem.
              • 5. Re: Send attachments with cfmail???
                JLSF Level 1
                Greetings and thanks - I think maybe I should clarify what I'm doing. I think your reply was close to what I need, but I'm a bit confused - sorry!

                I am sending a newsletter-type HTML email to our subscriber list (ourquery), and would like to ADD an attachment to that for viewing, specifically, a PDF for best viewability/printing. Here's the code we usually use to send out the newsletter:

                <CFMAIL
                TO="#ourquery.Email#"
                FROM="our reply email"
                TYPE="HTML"
                QUERY="ourquery"
                SERVER="scriptmail.our isp.net"
                SUBJECT="our subject line here">
                (HTML content goes here)
                </CFMAIL>

                So, within this scenario, where would I add the attachment (path?) and would it be the CFMAILPARAM code as you reccomend or a MIMEATTACH= CODE, or ???

                MANY THANKS!!!
                • 6. Re: Send attachments with cfmail???
                  Level 7
                  I am sending a newsletter-type HTML email to our subscriber list
                  (ourquery), and would like to ADD an attachment to that for viewing,
                  specifically, a PDF for best viewability/printing. Here's the code we
                  usually use to send out the newsletter:


                  That is what was shown in the first example, note the <cfmail ...>
                  wrapping the mail message and the two attached files, readme.txt and
                  logo.gif. This example also shows adding a couple of headers to the
                  mail message.

                  <cfmail from = "peter@domain.com" To = "paul@domain.com" Subject = "See
                  Important Attachments and Reply">

                  <cfmailparam name = "Importance" value = "High">

                  Please review the new logo. Tell us what you think.

                  <!--- An Attached File ---><cfmailparam file = "c:\work\readme.txt"
                  type="text/plain">
                  <!--- An Attached File ---><cfmailparam file = "c:\work\logo.gif"
                  type="image/gif">

                  <cfmailparam name="Disposition-Notification-To"
                  value="peter@domain.com">
                  </cfmail>



                  • 7. Re: Send attachments with cfmail???
                    JLSF Level 1
                    "The ColdFusion service user (default localSystem) must have permission
                    to do anything with the file system or other resource. If the
                    attachment was a local file on the server I would expect it to under the
                    default permissions of the default localSystem user. But if any of the
                    assumptions are incorrect it could cause a problem."

                    Q: when you say 'local file' and 'localsystem' user, are you referring to the server local to the file being run (e.g. our ISP server)? I'm just wondering if/how I might need to adjust the c:\ ...path to 'retrieve' the file I am trying to attach.

                    Many, many thanks!
                    • 8. Re: Send attachments with cfmail???
                      JLSF Level 1
                      Many thanks again for your assistance!

                      I designated your original reply as the answer, as that is what worked for me. Thank you also for your patience with me and assisting me in working this out. I consulted with my ISP for the correct path to the file and the code worked great!

                      Once again, many thanks!

                      JL