Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default Cfif in CFMAIL

    I am using the following to send an email based on information received through
    a form.:

    <cfoutput query="mailattachement"><cfset emailimage =
    '#submissions##sample1#'></cfoutput>

    <cfmail to="x@galleries-online.co.uk; [email]x@yahoo.co.uk[/email]"
    from="x@galleries-online.co.uk" <cfif (form.sample1) GT
    0>mimeattach="#emailimage#"</cfif> subject="Artist expression of interest"
    type="html">Hello all<br><br>The following artist has expressed an interest in
    joining Galleries-online<br><br><strong>Name:</strong> #form.name#<cfif
    (form.url) GT 0><br>
    <strong>Web address:</strong> <a href="#form.url#">#form.URL#</a>
    </cfif><br><br><strong>Comments from
    artist:</strong><br>#form.comments#<br><br>
    I'd really appreciate it if you could take a look at their work and let me
    know
    what you think. In order to do this, login in to the admin area at: <a
    href="http://www.galleries-online.co.uk/smslogin.cfm">[url]http://www.galleries-onlin[/url]
    e.co.uk/smslogin.cfm</a>
    and click on expressions of interest.<br>
    <br>Cheers<br><br>Neil</cfmail>

    Everything works fine until I try to place the 'mimeattach' part of the tag
    into a CFIF statement which results in the following:

    Just in time compilation error

    Invalid token found on line 59 at position 103. ColdFusion was looking at the
    following text:

    <

    The mimeattach attribute works fine otherwise.

    Cheers for any suggestions

    Neil


    neilorourker Guest

  2. Similar Questions and Discussions

    1. CFMAIL - CFIF
      Anyone have ideas how i could set up a survey form that emails to different email addresses depending on what the content of the survey is? I'm...
    2. Newbie help - CFIF and CFMAIL
      I can't figure out why this is not working. I have a form and once the elements of the form is completed, the info is email to me. Basically the...
    3. <cfmail></cfmail> in a script
      I am wondering if I can put <cfmail> tags and code within a javascript script. will the browser recognize it, and perform the instructions? ...
    4. cfmail - Attribute validation error for tag CFMAIL.
      I'm getting the error ' Attribute validation error for tag CFMAIL.' on the code below. All its doing is outputting a text string to the TO: field. ...
    5. cfif being ignored
      I wanted this to only execute if FORM.rp_image does not = defaultImg.gif but it seems to always run. I thought the syntax was okay but maybe not. ...
  3. #2

    Default Re: Cfif in CFMAIL

    The error was generated because you put a tag inside a tag. In order to fix it,
    use iif () (immediate if) function.


    Laksma Tirtohadi



    <cfmail to="x@galleries-online.co.uk; [email]x@yahoo.co.uk[/email]"
    from="x@galleries-online.co.uk" #iif(form.sample1 GT 0,
    DE("mimeattach=#emailimage#"), DE(""))# subject="Artist expression of interest"
    type="html">

    Laksma Guest

  4. #3

    Default Re: Cfif in CFMAIL

    thanks for your quick response.

    I tried pasting you code into the template but recieved the following error:
    Just in time compilation error

    Invalid token found on line 58 at position 103. ColdFusion was looking at the
    following text:

    #


    Neil

    neilorourker Guest

  5. #4

    Default Re: Cfif in CFMAIL

    It seems ColdFusion doesn't allow a CF function inside a CF tag. I usually use
    the technique in HTML tag.
    Anyway, instead of wasting the development time, use the following technique.
    Remember, this is NOT a good technique, but at least it works.

    <cfoutput query="mailattachement">
    <cfset emailimage = '#submissions##sample1#'>
    </cfoutput>

    <cfif form.sample1 GT 0>
    <cfmail to="x@galleries-online.co.uk; [email]x@yahoo.co.uk[/email]"
    from="x@galleries-online.co.uk" mimeattach="#emailimage#" subject="Artist
    expression of interest" type="html">
    Your email message.
    </cfmail>

    <cfelse>

    <cfmail to="x@galleries-online.co.uk; [email]x@yahoo.co.uk[/email]"
    from="x@galleries-online.co.uk" subject="Artist expression of interest"
    type="html">
    Your email message.
    </cfmail>

    </cfif>

    Laksma Guest

  6. #5

    Default Re: Cfif in CFMAIL

    Also, CFSAVECONTENT is a great help in these kinds of situations.

    <cfsavecontent variale="myVar">
    stuff goes here
    <cfif blah>
    more stuff
    </cfif>
    </cfsavecontent>

    <cfmail to=...fill in the rest... >
    #myVar#
    </cfmail>

    Fernis 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