• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfmail sending double attachments.

Contributor ,
Jan 30, 2010 Jan 30, 2010

Copy link to clipboard

Copied

Hello;

I wrote a cfmail app that allows you to send one attachment. Everything about it works fine. The problem is, it's sending 2 of the uploaded image and I can't figure out why. I'm not going to put in all my error code and so on, I'm just showing my cffile, and then the main part of my cfmail, I believe the problem is in how I'm attaching my file that is to be uploaded from the user.

<cffile action="upload"
                 filefield="attachment_1"
                 destination="c:\websites\187914Kg3\uploads\"
                 nameconflict="Makeunique" accept="#request.AcceptImage#">

<cfmail to="test@gmail.com"
        cc="another@gmail.com"
        from="#form.email#"
        subject="Submitted Idea"
        type="html" SpoolEnable="no"
        server="mail.gmail.com"
  port="25">
<cfmailparam name="X-Priority" value="1"/>

This is all my email stuff from the forms

<cfsilent>
     <cfif FORM.attachment_1 neq "">
        <cfmailparam file="#attachment_local_file_1#">
     </cfif>
  </cfsilent>
  <cfmailparam file="#CFFILE.ServerDirectory#/#CFFILE.ServerFile#" remove="true"/>
</cfmail>

and that's the main part of it aside from the form to send, and error control and those things.
Can anyone see what I'm doing wrong here? possibly help me fix my issue?

Thank you.

TOPICS
Advanced techniques

Views

549

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Jan 30, 2010 Jan 30, 2010

You have 2 cfmailparam tags therefore there are 2 copies of the attachment. Remove the cfmailparam outside the cfif statement. You may need to add the delete="true" to the cfmailparam inside the cfif tag.

Votes

Translate

Translate
Advocate ,
Jan 30, 2010 Jan 30, 2010

Copy link to clipboard

Copied

You have 2 cfmailparam tags therefore there are 2 copies of the attachment. Remove the cfmailparam outside the cfif statement. You may need to add the delete="true" to the cfmailparam inside the cfif tag.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 30, 2010 Jan 30, 2010

Copy link to clipboard

Copied

LATEST

Thank you! that worked. I was over thinking the process. Using a 2nd tag to delete the image on the server and I didn't need too. did what you said and it works perfect.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation