CFMail Dynamic Attachment

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default CFMail Dynamic Attachment

    Greetings, I have a form that a user fills out and it sudmits to a page that
    uses cfmail. That cfmail tag sends an attachment to a web admin. The attachment
    is a html page. This page is used on the users website. Here is my question...
    Is it possible to dynamically write to the html attachment on the fly when the
    form is submitted so that the dynamically generated info is included in the
    attachment? For example, a user puts in their street address. When the form is
    submitted, the html attachment gets sent to a web person. I want the users
    address to be in a specified location on the html page. If anyone knows how to
    do this, can you point me in the right direction? ~Clay

    fs22 Guest

  2. Similar Questions and Discussions

    1. cfmail attachment
      Can someone help Please. Not till I read a message in this board did I found out that the <cfmailparam file> tag only uploads files from the...
    2. CF5 cfmail sending blank .txt attachment
      we're having a wierd problem with CF5 CFMAIL. We sent out 350 emails and 300 were sent out with the correct attachment and 50 were sent out with...
    3. CFMAIL change attachment file content
      My application has function to export data as textfile. This generated textfile then will be sent via email as attachment. Generated file has...
    4. cfmail attachment not found on my computer
      I've seen many users here in the forum talking about attaching a file using the <cfmailparam> tag, but I can't get it to work. Please help me. Just...
    5. PHP To Create A Dynamic Text Attachment
      Hope someone can help. I am trying to write a php script that will create a text file with dynamic fields in it,save the page and then mail it as an...
  3. #2

    Default Re: CFMail Dynamic Attachment

    I do it like this: <cfquery name='inputdet' datasource='solicit'> insert into
    reqdetail (ID, reqdetail) values ('#form.id#', '#form.details#') </cfquery>
    <cfquery name='getdetails' datasource='solicit'> Select tracknum, summary,
    bydate, priorty, type, address From reqinfo Where tracknum = '#form.id#'
    </cfquery> <cfoutput query='getdetails'> <cfmail to='xxxxxxx@xxxx.com'
    from='xxxxx' subject='#form.subject#' server='xxxxxxx' type='html' >
    <br> Summary:&amp;nbsp;&amp;nbsp; <strong>#summary#</strong><br> <br>
    Priorty:&amp;nbsp;&amp;nbsp;<strong>#priorty#</strong><br> <br> Due
    on:&amp;nbsp;&amp;nbsp;<strong>#dateformat(bydate) #</strong><br> <br>
    Details:&amp;nbsp;&amp;nbsp; <strong>#form.details#</strong> address:
    #address# </cfmail> </cfoutput> I think thats what your talking about. Form.id
    is a hidden field in my form I run the query after the insert, that way I can
    pass the values in a cfoutput, that way I don't have to send an attachment.
    Cheers Chris

    StokeyTCI Guest

  4. #3

    Default Re: CFMail Dynamic Attachment

    In this case, I need to send the attachment and I am not inserting the data into a database. Is there a way to do it without inserting?

    ~Clay
    fs22 Guest

  5. #4

    Default Re: CFMail Dynamic Attachment

    you can pass the form variables without imputing to the database, just loose the query, and wrap the form variables in a <cfoutput> #form.variables#</cfoutput>
    StokeyTCI Guest

  6. #5

    Default Re: CFMail Dynamic Attachment

    How do I pass those variables to my attachment?

    ~Clay
    fs22 Guest

  7. #6

    Default Re: CFMail Dynamic Attachment

    You need to create the HTML file using <cffile action="write"> then add it via
    cfmailparam DO NOT delete the file right away as the email is not always sent
    immediately and if you delete the file it wont be able to attach it.

    You will probably need to use cfschedule to clear out old items on a regular
    basis.

    Stressed_Simon Guest

  8. #7

    Default Re: CFMail Dynamic Attachment

    My difficulty with the cffile tage is that when I put my html code in the
    output field, I generate an error due to the tags in my html code. Is there a
    way to fix this? If so, then I can do what I am attempting.

    fs22 Guest

  9. #8

    Default Re: CFMail Dynamic Attachment

    Use cfsavecontent to set it to a variable and then use cffile to save that!
    Stressed_Simon Guest

  10. #9

    Default Re: CFMail Dynamic Attachment

    Thanks for the assist and I sort of got it to work. Here is a sampling of my
    code...

    <cfset page = "<%Response.Buffer = True%>
    <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>
    <html>
    <head>
    <title>iNet Home Page</title>
    </head>
    <body onLoad='window.focus()'>
    etc... etc...

    <cffile action="write" output="#page#"
    file="E:\inetpub\wwwroot\legacyweb\isg\education\i net\inetsetupform\templates\op
    aol.htm">

    <cfmail from="clay.hess@activant.com" to="clay.hess@activant.com"
    subject="#FORM.Store_Name#'s #FORM.subject#"
    mimeattach="E:\inetpub\wwwroot\legacyweb\isg\educa tion\inet\inetsetupform\templa
    tes\opaol.htm">
    </cfmail>

    I get this code to work, but my problem is that I use the <style></style> tags
    on the original page and that seems to mess things up due to the semi-colon at
    the end of each style tag line.

    How do I get around this?

    ~Clay

    fs22 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139