5 Replies Latest reply on Apr 6, 2010 12:42 PM by plarts

    Paste an image in a CFmail

    plarts Level 1

      When using

      a Mail user Agent (Outlook for example), we can paste an image inside the body of the mail,

      which is great to show something to someone else rapidly.

       

      Is there a way for doing the same thing using CFmail,

      I know the cfmail boby will take the content of a textarea or an HTML online editor, from a form,

      and we cannot paste an image in these 2 cases.

       

      So how to make a webmail with CF as powerfull as another mail agent ?

      to rapidly paste an image in the body ?

       

      If I save my image in local, then I upload to the server, then I can reference to it,

      but this is too long and too heavy.

       

      Thanks for any help with this ?

      Pierre.

        • 1. Re: Paste an image in a CFmail
          Fernis Level 3

          Outlook is an email client. CFMAIL is not, in any way. CFMAIL can take any ColdFusion variable contents as the mail body.

           

          You can compose HTML emails with inline images, however, with CFMAIL.


          <cfset myImgPath = expandPath('./') & "pics/">

           

          <cfmail from="address@domain.com" to="recipient@domain.com" subject="Inline image test">

           

          I should see a sunrise image below:<BR/>

          <img src="cid:img1"><BR/>

          and a moon below:<BR/>

          <img src="cid:img2">


          <cfmailparam disposition="inline" contentid="img1" file="#myImgPath#sunrise.jpg">

          <cfmailparam disposition="inline" contentid="img2" file="#myImgPath#moon.jpg">

          </cfmail>

           

          You need to have the images on the ColdFusion server side before you can embed them into the email. If you use a ColdFusion server-side component as a WYSIWYG editor, such as fckeditor or ckeditor, just make sure the images are loaded up from the server side. Then it's just a matter of parsing the email content so that the <img> tags point to embedded cid: objects instead of server urls - and assigning each image an identifier with the cfmailparam tag. But I'm not going to go into details on that one.

           

          --

          -Fernis - fernis.net - ColdFusion Developer For Hire

          • 2. Re: Paste an image in a CFmail
            plarts Level 1

            Thanks for this answer,

             

            So in any case, the user need to save his image (local) and upload to the server,

            before being able to insert it in an online editor and send it.

             

            I think it is not possible

            Only if people from FCKeditor and CF adobe work together to make it works,

            may be ?

             

            Is this true ?

            People want the most easy way. So just paste and send.

            Like in an Email agent.

            (no save, no upload, then compose your mail and send)

             

            Thanks, may be a future functionnality ?

            • 3. Re: Paste an image in a CFmail
              Fernis Level 3

              There is no reason this should be a future functionality, since it's totally out of ColdFusion's scope as a server side solution to act as a client-side e-mail application.

               

              When you are using Outlook, for example, you tell Outlook to search files from somewhere, whether it's a drag-drop action or not. This is already virtually the same thing as running ColdFusion on the same machine where you have the images. You are already using a dedicated software application to handle images on the same machine where the images are AND where you send the e-mail from.

               

              In order to have seamless copy-paste on your local images, and have them sent from the server side, fckeditor (which runs client-side on Your computer) would need to "steal" the images from your DOM model without anyone noticing, and upload them to the server side. Browsers do not allow this due to security concerns.

               

              The only way to go around this is using dedicated flash/java applets for email editing or image uploading on your browser, or browser extensions (such as Google Gears)

               

              So, if you forget security, browser compatibility, etc., you might be interested in this:

              http://fvisticot.blogspot.com/2009/06/google-gears-desktop-drag-and-drop.html

               

              -Fernis - fernis.net

              • 4. Re: Paste an image in a CFmail
                ilssac Level 5

                plarts wrote:

                 

                Is this true ?

                People want the most easy way. So just paste and send.

                Like in an Email agent.

                (no save, no upload, then compose your mail and send)

                 

                Thanks, may be a future functionnality ?

                 

                Fernis has already given the answer, but to drive the point home.

                 

                Show me a Server side (I.E. web based) E-mail tool that allows drag and drop image|file attachement without uploading them to the server first.

                 

                G-Mail, Hotmail, Yahoo Mail, Godaddy, I've used them all and they all require the user (me) to upload my files before I can attach them to the e-mail message I am composing in my browser.  Some make the interface easier then others, but they all upload the file.

                 

                Tools like Outlook, Thunderbird, etc are client side software.  That is something completely different then server based technologies like ColdFusion.

                 

                If the world moves to true cloud based and our clients become little more then dumb terminals, this may change.  But I would hold my breath for that revolution, it could be the next decade or more before we are using computers like that.

                • 5. Re: Paste an image in a CFmail
                  plarts Level 1

                  Well, I understand well the situation.

                  Thanks for your explanation and clarifications.

                   

                  Pierre.