Cfmail mulitiple attachments?

This isn't working... please advise. I need to attach
mulitiple documents.....
<cfmail to="#t.email#"
subject="Purchase"
from="[email protected]"
password="hdfd"
username="purchase.request"
cc=""
type="html"
server="mail2.corp.org"
mimeattach="d:\coldfusion
applications\pages\onlineforms\purchaserequest\Purchase Order
Request-#session.purchaserequestid#.pdf"
> <cfmailparam file =
"D:\filespload\#session.filename1#" >
</cfmail>

You can use multiple cfmailparam tags inside your cfmail to
attach multiple files. You might try removing the mimeattach
attribute and use cfmailparam for all your attachments.

Similar Messages

  • Cfmail w/attachments issues

    Hi there,
    I have a basic html form where the user can add attachments.
    The action form uses cfmail to send an email to an address with the
    form contents as well as the attachment. However, I am having
    issues with this part and am at a loss. Do i need to do an upload
    first? or mim attachment? Any help would be appreciated. Thanks in
    advance.
    My cfmail code looks like this:
    <cfoutput>
    <cfmail to="[email protected]"
    from="a test person"
    subject="Request for yada yada">
    Name: #form.name#
    Article: #form.text#
    <cfmailparam file="#form.file1#"> (If i actually put
    in /tmp/test.txt which is a file on the drive i am mapped to, then
    the cfmail works and delivers .. but this doesn't help me for other
    people and their attachments)
    </cfmail>
    </cfoutput>
    This never goes to the email address.. instead it goes to
    undeliverable with this log. (p.s. I use my actual email address
    for the 'to')
    body: Name: test
    body: Article: t3est
    body: Files:
    /engines/coldfusionmx7/runtime/servers/coldfusion/SERVER-INF/temp/wwwroot-tmp/neotmp40024 .tmp
    file:
    /engines/coldfusionmx7/runtime/servers/coldfusion/SERVER-INF/temp/wwwroot-tmp/neotmp40024 .tmp
    file-type: application/octet-stream; name=neotmp40024.tmp
    file-disposition: attachment

    quote:
    Originally posted by:
    Gnatflea
    Thanks for the reply. I decided to try an cffile = upload for
    the file, but got an error message that time: (the .tmp file name
    is not the name of the file i attempted to attach). I really want
    to use the first option you gave and I thought i had done this
    correctly.
    The form field
    "/engines/coldfusionmx7/runtime/servers/coldfusion/SERVER-INF/temp/wwwroot-tmp/neotmp4009 2.tmp"
    did not contain a file.
    The error occurred in
    /engines/iplanet/v6.0/docs/intranet/exchange_action.cfm: line 12
    10 : #form.file1#
    11 : <cffile action = "upload"
    12 : fileField = "#form.file1#"
    13 : destination = "/logs/iplanet/docs/eol/secure/exchange/"
    14 : accept = "image/gif,application/msword">
    Things to check
    1. Does your form tag include enctype="multipart/form-data"
    If these suggestions don't work please post all of your code.
    Edit: Removed incorrect suggestion related to file
    path

  • Renaming attachments on the fly with CFMAIL?

    One feature of our app allows our clients to send email to a
    specific contact with an attached PDF. This PDF is built from
    stitched together files in a previous step, so it has a
    dynamically-built filename.
    The filename consists of the subject, date, and some other
    info. We were adding a hash value to the end of the filename so we
    would have a unique value and avoid overwrites, but now it's
    setting off spam filters, and people aren't getting the email.
    I replaced the hash value with the timestamp, including
    milliseconds, which seems to work well enough to keep the file
    unique. This is fine for our database, but the boss wants the
    receipient to see a "friendly" version of the filename as their
    attachment. In other words, I need to strip out that other data
    (timestamp) when I send it.
    I thought there used to be a way to send attachments where
    you have the source file name and the destination file name... but
    apparently there isn't now, as far as I can see.
    Does anyone know how to do this? It seems like it would be a
    common issue. I know I could try to copy the file to the
    tempdirectory with a "Friendly" name, then send that as the
    attachment and delete it... but that seems excessive.

    Hopefully it will help me organise things. I’ve liked having twin drives on my G5. (Though in that case there’s the added advantage of the physical security of holding vital files on two real drives.) And I always intended to partition next time I got a new Mac.

  • CFMail breaks up attachments filename with non ASCII

    Hi CF-Devs out there!
    My problem is, that when attaching files via cfmailparam - no
    matter if inline or not - and using a filename that contains or a
    non 7bit-ASCII character or a simple space, the filename is not
    displayed correctly in Outlook nor Thunderbird. I am sure that this
    topic has been discussed here earlier but I really don't find any
    topic when using the Forum Search function... so please help anyway
    :) I am still using CFMX 6.1 :(
    My code is the following:
    <cfmailparam type="#variables.attachments
    .getContentType()#"
    file="#variables.attachments.getFilename()#"
    disposition="#this.dispositionType(variables.attachments
    .isInline())#"
    contentID = "#variables.attachments.getCid()#">
    When I revise the generated email code then I find the
    following:
    Content-Type: application/octet-stream
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename*2=nger.csv;
    filename*0*=UTF-8''emailempf; filename*1*=%c3%a4
    Content-ID: <DEE13419-D022-9396-C8A4DF2AAAA7C4EF>
    You can see that the filename (emailempfänger.csv)
    breaks up into several pieces which according to
    RFC 2231 is a
    valid format but obviously is not interpreted correctly by e.g.
    Outlook. Or am I missing something else?
    I would appreciate your help. Thanks in advance.
    Buergermeister

    The filename you used does not contain any non 7bit ASCII
    character. The problem only occurs if I use characters like
    "ä","ö","ü" but even [space] does provoke the error.
    The variables hold the following values (you can see them in
    the source posted, too):
    1) variables.attachments.getContentType() :
    application/octet-stream
    2) variables.attachments.getFilename() :
    [AbsoluteFilePath]/emailempfänger.csv
    3) this.dispositionType(variables.attachments.isInline()) :
    attachment
    4) variables.attachments.getCid():
    DEE13419-D022-9396-C8A4DF2AAAA7C4EF
    Cheers!

  • Cfmail attachments not working

    So I have a web page that...
    1 Generates an excel file.
    2 Saves the excel file to my webserver.
    3 Sends an email with the excel file attached.
    If the user opens the email via desktop outlook the attached
    excel file will open and display just fine. If the user opens the
    email via web outlook the attachment won't open. I have no idea if
    this is a coldfusion problem our an outlook problem. Does anyone
    have any idea's what would cause this to happen?
    Thanks

    It opens fine when I double click it on the server. The
    correct tag is
    <cfsavecontent variable="mypage">
    <html xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns="
    http://www.w3.org/TR/REC-html40">;
    <head>
    <meta http-equiv=Content-Type
    content="application/vnd.ms-excel; charset=windows-1252">
    <meta name=ProgId content=Excel.Sheet>
    <meta name=Generator content="Microsoft Excel 9">
    <link rel=File-List
    href="./headcountest_files/filelist.xml">
    <link rel=Edit-Time-Data
    href="./headcountest_files/editdata.mso">
    <link rel=OLE-Object-Data
    href="./headcountest_files/oledata.mso">
    Then my table that is getting output
    </cfsavecontent>
    <cfset mypath =
    "C:\mypath\Excel\itinerary_#uname#.xls">
    <cffile action="write" file="#mypath#"
    destination="C:\mypath\Excel" output="#mypage#">
    This creates the excel file and saves it to my webserver.
    I then do my <cfmail> and attach the file that I just
    created. The metatags tell it to create the excel file.

  • Cfmail sending double attachments.

    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="[email protected]"
            cc="[email protected]"
            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.

    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.

  • How to  delete email attachments from server

    Hi,
    I created an a CF template for sending e-mail which includes
    attachments. It has been tested on my dev box and is functioning
    fine as the attachment upload to a designated directory on the
    server. I would like the attachments to be purged once the e-mail
    has been forwarded to the recipent.
    In Macromedia's ColdFuision 7MX web application construction
    book page 913 "Interacting with Email" there is a CFC that will
    delete the file when the user ends their session.
    I am not sure how to write this to fit the code I am using.
    Here is the eMail form
    <!--- Mail_Form.cfm--->
    <html>
    <head>
    <title>Please enter your message</title>
    </head>
    <body>
    <form action="Send_Email.cfm" method="post"
    enctype="multipart/form-data">
    <table width="500" border="0" align="center">
    <tr>
    <td width = "500" colspan="2">Please enter your e-mail
    message:</td>
    </tr>
    <tr>
    <td width="250">To:</td>
    <td width="250"><input type="text" name="to_addr"
    value=""></td>
    </tr>
    <tr>
    <td>Subject:</td>
    <td><input type="text" name="subject"
    value=""></td>
    </tr>
    <tr>
    <td>Message:</td>
    <td><input textarea name="message" rows="5"
    cols="35"></textarea></td>
    </tr>
    <tr>
    <td width="250">Attachment #1:</td>
    <td width="250"><input type="file"
    name="attachment_1" value=""></td>
    </tr>
    <tr>
    <td width="250">Attachment #2:</td>
    <td width="250"><input type="file"
    name="attachment_2" value=""></td>
    </tr>
    <tr>
    <td width="250">Attachment #3:</td>
    <td width="250"><input type="file"
    name="attachment_3" value=""></td>
    </tr>
    <tr>
    <td width="250"> </td>
    <td width="250"><input type="submit"
    name="Send_Email" value="SendEmail"></td>
    </tr>
    </table>
    </form>
    Here is the form to send the attachment.
    <!--- Send_Email.cfm --->
    <!--- First make sure that the user uploaded attachments
    --->
    <cfif FORM.attachment_1 neq "">
    <!--- first actually upload the file --->
    <cffile action="upload"
    destination="D:\uploadsTEST\"
    filefield="attachment_1"
    nameconflict="makeunique">
    <!--- now create a temporary holder for the attachment
    later on --->
    <cfset attachment_local_file_1 =
    "d:\uploadsTEST\#file.serverfile#">
    </cfif>
    <!---Now repeat the process for the second and third
    attachment:--->
    <cfif FORM.attachment_2 neq "">
    <!--- first actually upload the file --->
    <cffile action="upload"
    destination="D:\uploadsTEST\"
    filefield="attachment_2"
    nameconflict="makeunique">
    <!--- now create a temporary holder for the attachment
    later on --->
    <cfset attachment_local_file_2 =
    "d\uploadsTEST\#file.serverfile#">
    </cfif>
    <cfif FORM.attachment_3 neq "">
    <!--- forst actually upload the file --->
    <cffile action="upload"
    destination="D:\uploadsTEST\"
    filefield="attachment_3"
    nameconflict="makeunique">
    <!--- now create a temporary holder for the attachment
    late on --->
    <cfset attachment_local_file_3 =
    "d:\uploadsTEST\#file.serverfile#">
    </cfif>
    <!---OK, you have now uploaded the file the server, now
    let's send
    out the email with the attachments:--->
    <cfmail FROM="[email protected]" to="#form.to_addr#"
    subject="#subject#"
    server="an001so-dby1c.pbi.global.pvt" port="25">
    #message#
    <cfsilent>
    <!--- <cfsilent> tag used to kill the white space
    in this area
    so your email is not cluttered with white space.--->
    <cfif FORM.attachment_1 neq "">
    <cfmailparam file="#attachment_local_file_1#">
    </cfif>
    <cfif FORM.attachment_2 neq "">
    <cfmailparam file="#attachment_local_file_2#">
    </cfif>
    <cfif FORM.attachment_3 neq "">
    <cfmailparam file="#attachment_local_file_3#">
    </cfif>
    </cfsilent>
    </cfmail>
    Here is the session application code to delete the file upon
    uploading
    <!---
    Filename: Application.cfc
    Executes for every page request
    --->
    <cfcomponent output="false">
    <!--- Name the application. --->
    <cfset this.name="attachmentPurge">
    <!--- Turn on session management. --->
    <cfset this.sessionManagement=true>
    <cfset this.clientMangment=true>
    <cffunction name="onSessionEnd" output="false"
    returnType="void">
    <!--- Look for attachments to delete --->
    <cfset var attachDir = expandPath("Attach")>
    <cfset var getFiles = "">
    <cfset var thisFile = "">
    <!--- Get a list of all files in the directory --->
    <cfdirectory directory="#attachDir#" name="getFiles">
    <!--- For each file in the directory --->
    <cfloop query="getFiles">
    <!--- If it's a file (rather than a directory) --->
    <cfif getFiles.type neq "Dir">
    <!--- Get full filename of this file --->
    <cfset thisFile =
    expandPath("Attach\#getFiles.Name#")>
    </cfif>
    </cfloop>
    </cffunction>
    </cfcomponent>
    The tutorial only explains how to delete the attachment when
    the recipient checks there mail
    in the POP server.
    Assuming that the sender is in a session would the code be
    written to delete the attached file from the directory on
    the server one the e-mail is sent.
    Can someone explain how to automatically delete email
    attachments from a designated directory or provide me with the code
    that would handle this after an email is sent with attachment.
    Thanks,
    Tony

    I don't know why your dos code didn't run. It could be
    addressing. My limited experience with cfdirectory/cffile/cfexecute
    is to type out the complete path at least once.
    Good books?
    Hard to say, depends on what else you are new at. If you are
    new to html, then htmlgoodies.com has good tutorials. So does
    webmonkey.com. If you have trouble with sql, I have heard good
    things about the SAMS book, Teach Yourself SQL in 10 Minutes by Ben
    Forta. I learned javascript by buying the book Teach Yourself
    Javascript in 24 Hours. The O'Reilly books are also good. I learned
    awk with one of those books.
    Glad you liked the fish pics. The camera is specified on most
    of the pages. If it says Reefmaster, I used an external strobe. If
    it says Sony I either used the camera flash only or natural light.
    By the way, that is not a Cold Fusion site. It's strictly html and
    javascript.

  • CFMail Attachment Issue (410 character limit)

    My company is in the process of upgrading from CF5 to CFMX7
    (v7.0.2). While testing the new version our test environment, I've
    discovered an issue (that didn't exist in CF5) regarding email
    attachments. I've scoured the internet looking for users who might
    have run into this issue and haven't found any.
    Here's the problem that shows up when using CFMX7. Emails
    that have attached files that have lines of code that are longer
    than 410 characters per line have the lines broken apart with a
    newline character.
    So for example if code in a file originally looked like this,
    <font face='courier new' size=-2>
     &nbspLIFE  MED  (line
    continues out to over 600 chacters)...
    </font>
    The received file would have code that looked like this,
    <font face='courier new' size=-2>
     &nbspLIFE  MED  (line
    continues out to just 410 chacters, then breaks to a new line)...
    bsp; &nbspLIFE   
    </font>
    Notice that the non-breaking space characters starting the
    second line have been chopped off.
    This causes an issue because the files we are attaching to
    the emails are bills (formatted in html) that uses a lot of
    non-breaking space ( ) characters for formatting purposes.
    Most of the lines of code are greater then 410 characters wide, and
    once the the   characters start to get broken apart, they
    end up displaying in a browser.
    Things I've tried that haven't helped.
    1) Changing the Default CFMail Charset from UTF-8 to US-ASCII
    2) Using the cfmailparam tag instead of the mimeattach
    attribute
    3) Applied hot fix hf702-65414 (which was for an issue
    regarding email spooling)
    Does anyone know how I would prevent the line break issue in
    CFMX7?
    I figured I'd ask around in a few newsgroups before we
    started spending money on support from Adobe.
    Thanks,
    Wayne Barca

    If the attached file doesn't have to be interactive, how
    making it a PDF?

  • CFMAIL with zip-attachment

    I have a function which creates some xls-files and pack it
    into a zip-archive, the created file is named 1234.zip and is saved
    at the server. This function works correct.
    After that the created file should be send by cfmail but when
    I receive the mail the attached file is named
    att23423.att or similar. The file itself is correct, I can
    open it with winZip but I also need the correct filename for the
    attachment.
    I run the same function for sending xls- or pdf-files and
    this works!
    Any Ideas?? I would appreciate any suggestion.
    I use CF MX7.02 and here is a snippet of the relevant code:
    <cfmail to="#sender#" bcc="#receiver#" from="#sender#"
    subject="#subject#" server="#application.smtp_server#"
    port="#application.smtp_serverport#" type="HTML">
    ...<cfmailparam file="#attach_file_name#"
    type="application/zip">...
    </cfmail>

    Hi Guido,
    There is not a very complex configuration required for attachments. You have to follow the general configuration steps along with the instructions mentioned at below link -
    http://www.b2bgurus.com/2008/11/attachment-feature-in-ebms-using-oracle.html
    Regards,
    Anuj

  • CFMail Issues since Upgrading to CF10

    Ever since upgrading to CF10, we've been having some odd issues with our automated ColdFusion emails.  The processes always functioned properly in the past, but lately we've been getting some very out of the ordinary issues which I'll describe further below.
    We discover the problem usually from contacts who usually receive these emails on a daily basis with or without attachments.  We'll go to the CFMAIL directory for the corresponding server and find a slew of emails stuck in the 'Undelivr' emails.  In some cases, we can just move these emails to the Spool folder and they process fine, but in most cases they result in one of the two errors below:
    Error 1: In an email which normally does not contain a body and contains an attachment, the follow error is what we found in the logs:
    "Error","scheduler-1","01/15/13","14:09:56",,"javax.mail.MessagingException: missing body for message"
    javax.mail.MessagingException: missing body for message
                    at coldfusion.mail.MailImpl.createMessage(MailImpl.java:696)
                    at coldfusion.mail.MailSpooler.deliver(MailSpooler.java:1295)
                    at coldfusion.mail.MailSpooler.sendMail(MailSpooler.java:1197)
                    at coldfusion.mail.MailSpooler.deliverFast(MailSpooler.java:1657)
                    at coldfusion.mail.MailSpooler.run(MailSpooler.java:1567)
                    at coldfusion.scheduling.ThreadPool.run(ThreadPool.java:211)
                    at coldfusion.scheduling.WorkerThread.run(WorkerThread.java:71)
    Placing these emails that have always been sent out this way in the past without an attachment in the spool directory causes it to go right back in the 'Undelivr' folder and resulting in the same error.  We ended up having to modify the email file and add random content in the body message, place it back in the spool directory, and it went through.  - Mind boggling.
    Error 2:
    "Error","scheduler-2","02/04/13","09:08:17",,"javax.mail.MessagingException: Exception reading response;   nested exception is:
    java.net.SocketException: Connection reset"
    Both errors occur randomly and we have not been able to find out what causes them randomly from time to time.  All other emails go through fine, but certain emails will never go out and end up in the 'Undelivr' folder. 
    We are running them on Windows Server 2008 64bit.

    Peter, thanks for your suggestions however, the receipients in our email are either customers or internal users; which in any of the email issues we've been having, an invalid email address was not the cause.  Also, to note - these are not marketing emails.
    Just standard batch notification emails, e.g., order / warehouse notification, daily automated processes, etc.  I do wish it were something that simple to resolve these email issues once and for all.
    One other possible cause I've been looking at is "TCP/IP Port Exhaustion" - More info here http://msdn.microsoft.com/en-us/library/aa560610%28v=bts.10%29.aspx
    However, not sure how to exactly prove this to be the cause. 

  • CFMAIL Attached vs. embedded (cfmail, multipart/mixed)

    I want to send a mail which has a PDF attachment and an embedded image. When I send them both with cfmailparam (with correct disposition) they arrive in the email as attachments in the body...you don't get the little email paperclip attachment icon.
    When I tried using mimeattach for the PDF it did work!...but the image denoted with cfmailparam also came through like that. So I looked the email headers of both and the good one was Content-Type: multipart/mixed; while the bad one was "multipart/related".
    So how can I make cfmailparam send it as multipart/mixed? (if that's even the right question...maybe I should stick with mimeattach and do something else?)
    Thanks Folks' - Randy

    I never found a solution using cfmail.  I had to resort to java instead.
    I have all of my file information (including content) in a query called qFiles and loop through that in the code below.
    <cfscript>
        // config will stay this way
        emailServer = serverAddressHere;
        emailServerAccount = "";
        emailServerPwd = "";
        //  set email variables
        vSentFrom = sentFromEmailHere;
        vSubjectText = subjectHere;
        recipientsTo = listToArray( SentToListHere );
        recipientsCC = listToArray( CCListHere );
        recipientsBCC = listToArray( BCCListHere );
        // set javamail properties
        props = createObject("java", "java.util.Properties").init();
        props.put("javax.mail.smtp.host", emailServer);
        // get static recipient types
        recipientType = createObject("java", "javax.mail.Message$RecipientType");
        // create the session for the smtp server
        mailSession = createObject("java", "javax.mail.Session").getInstance(props);
        // create a new MIME message
        mimeMsg = createObject("java", "javax.mail.internet.MimeMessage").init(mailSession);
        // create the to and from e-mail addresses
        addrFrom = createObject("java", "javax.mail.internet.InternetAddress").init(vSentFrom);
        for (cfIdx = 1; cfIdx LTE arrayLen( recipientsTo ); cfIdx++)
            addrTo[cfIdx] = createObject("Java", "javax.mail.internet.InternetAddress").init( recipientsTo[cfIdx] );
            // add a recipient
            mimeMsg.addRecipient(recipientType.TO, addrTo[cfIdx]);
        if(ArrayLen(recipientsCC)){
            for (cfIdx = 1; cfIdx LTE arrayLen( recipientsCC ); cfIdx++)
                addrCC[cfIdx] = createObject("Java", "javax.mail.internet.InternetAddress").init( recipientsCC[cfIdx] );
                // add a recipient
                mimeMsg.addRecipient(recipientType.CC, addrCC[cfIdx]);
        if(ArrayLen(recipientsBCC)){
            for (cfIdx = 1; cfIdx LTE arrayLen( recipientsBCC ); cfIdx++)
                addrBCC[cfIdx] = createObject("Java", "javax.mail.internet.InternetAddress").init( recipientsBCC[cfIdx] );
                // add a recipient
                mimeMsg.addRecipient(recipientType.BCC, addrBCC[cfIdx]);
        // build message
        // set who the message is from
        mimeMsg.setFrom(addrFrom);
        // set the subject of the message
        mimeMsg.setSubject(vSubjectText);
        // create multipart message: only needed if you're including both plain/text and html
        // or using attachments
        multipart = createObject("java", "javax.mail.internet.MimeMultipart").init();
        // specifies that the message contains both inline text and html, this is so that
        // images given a cid will show up when rendered by the e-mail client
        multipart.setSubType("mixed");
        // create html text multipart
        oHtml = createObject("java", "javax.mail.internet.MimeBodyPart").init();
        // add the html content (the setText() method shortcut/only works for "plain/text")
        oHtml.setContent( emailContentHTML, "text/html");
        // add the body part to the message
        multipart.addBodyPart(oHtml);
        // loop over files to attach to the email
        for ( intRow = 1 ; intRow LTE qFiles.RecordCount ; intRow = (intRow + 1))
        // set file info to vars
        fileContent = qFiles["fileContent"][intRow];
        fileMimeType = qFiles["mimeType"][intRow];
        fileName = rereplace( qFiles["filename"][intRow] , '(?!\.[^.]*$)\W' , '' , 'all' );
        if(len(fileName) > 50)
        {fileName = mid(fileName,1,44) & right(fileName,find('.',reverse(fileName)));}
        // attach an inline binary object
        att = createObject("java", "javax.mail.internet.MimeBodyPart").init();
        // create an octet stream out of the binary file
        os = createObject("java", "org.apache.axis.attachments.OctetStream").init(fileContent);
        // we now convert the octet stream into the required data source. using an octet stream
        // allows us pass in any binary data as a file attachment
        osds = createObject("java", "org.apache.axis.attachments.OctetStreamDataSource").init("", os);
        // initialize the data handler using the data source
        dh = createObject("java", "javax.activation.DataHandler").init(osds);
        // pass in the binary object to the message--javamail will handle the encoding
        // based on the headers
        att.setDataHandler(dh);
        // define this binary object as a PDF
        att.setHeader("Content-Type", fileMimeType);
        // make sure the binary data gets converted to base64 for delivery
        att.setHeader("Content-Transfer-Encoding", "base64");
        // specify the binary object as an attachment
        att.setHeader("Content-Disposition", "attachment");
        // define the name of the file--this is what the filename will be in the e-mail client
        att.setFileName(fileName);
        // add the body part to the message
        multipart.addBodyPart(att);
        //end loop through qFiles
        // place all the multi-part sections into the body of the message
        mimeMsg.setContent(multipart);
        // in this section we'll build the message into a string. you could dump
        // the string to a file in most SMTP server's queue file for delivery
        // this is exactly what would be pass to the SMTP server
        // create a bytearray for output
        outStream = createObject("java", "java.io.ByteArrayOutputStream");
        // create a budder for the output stream
        outStream.write(repeatString(" ", 1024).getBytes());
        // save the contents of the message to the output stream
        mimeMsg.writeTo(outStream);
        // save the contents of the message to the sMailMsg variable
        sMailMsg = outStream.toString();
        // reset the output stream (for stability)
        outStream.reset();
        // close the output stream
        outStream.close();
        // create a transport to actually send the message via SMTP
        transport = mailSession.getTransport("smtp");
        // connect to the SMTP server using the parameters supplied; use
        // a blank username and password if authentication is not needed
        transport.connect(emailServer, emailServerAccount, emailServerPwd);
        // send the message to all recipients
        transport.sendMessage(mimeMsg, mimeMsg.getAllRecipients());
        // close the transport
        transport.close();
        </cfscript>

  • How can i secure email with attachments using coldfusion

    Hi,
    I need to send emails with attachments containg word, excel or PDF documents using cfmail. However this email needs to be really secure. How is the best way to secure the entire email with its attachments.
    Any ideas appreciated
    Thanks
    Zubair

    Hi ,
    I hope the following will help you..., using the UTL_SMTP db package.
    DECLARE
    c UTL_SMTP.CONNECTION;
    PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
    BEGIN
    UTL_SMTP.WRITE_DATA(c, name || ': ' || header || UTL_TCP.CRLF);
    END;
    BEGIN
    -- Open connection to SMTP gateway
    c := UTL_SMTP.OPEN_CONNECTION('smtp.server.acme.com');
    UTL_SMTP.HELO(c, 'acme.com');
    UTL_SMTP.MAIL(c, '[email protected]');
    UTL_SMTP.RCPT(c, '[email protected]');
    UTL_SMTP.OPEN_DATA(c);
    send_header('From', '"Oracle Admin" ');
    send_header('To', '"Bob Smith" ');
    send_header('Subject', 'Automated Database Email');
    UTL_SMTP.WRITE_DATA(c, utl_tcp.CRLF || 'This is an automated email from the Oracle database.');
    UTL_SMTP.WRITE_DATA(c, utl_tcp.CRLF || 'The database is working for you!');
    UTL_SMTP.CLOSE_DATA(c);
    UTL_SMTP.QUIT(c);
    END;
    Simon

  • Quicklook downloads attachments to wrong folder

    Tried searching for this but came up empty so I want to try and see if others are wondering why Quicklook in Mail downloads the attachment to a folder different from the one I specified as my Downloads folder, in my case, my Desktop Folder.
    I receive an email with an attachment. I use Quicklook (be it the button on the header, pressing the spacebar, or using the contextual menu) to view the file at which time Mail first downloads the attachment. However, it always downloads it to the User/Library/Mail Downloads folder instead of the Downloads folder I selected in Preferences.
    Does anyone else have this "problem?" If so, is there a setting for this I am not seeing? I hope it can be changed because I habitually use Quicklook now and that Mail Downloads folder can fill up rather quickly without realizing as I download attachments to specific places after the fact, causing double copies on my hard drive. Hope someone can help.

    Andew, thanks for the reply, however, I am with "gumsie" on this one. Like gumsie stated, if I save the attachment using the button in the header or contextual menu, and open the file from there, then there is no real problem. However, if I Open or Quicklook the attachment directly in the Message Window, then Mail does save a copy of the attachment to the /Library/Mail Downloads folder no matter if I saved the attachment before or if I have a Downloads folder set in Preferences. This is what I think is an odd bit of behavior from the software.
    In the end, I think there is really nothing we can do about this and the best thing for me to do is just download the attachment to my set Downloads folder, and Open/Quicklook it from there in order to avoid multiple copies on my drive (I deal with largish files so cumulatively multiple copies just take up too much space on the drive). It's too bad Apple hasn't addressed this.
    Thank you both for your input. At least now I know that A) I'm not alone in this and B) I just have to change my habits.

  • Previewing attachments

    I was previewing attachments, pictures .png files, at least 30 or 40 of them and then all of a sudden I got an error message that
    "this file cannot be previewed. try opening the file in the program in which it was created" and now I can't preview even the pictures I previously did.
    What happened? What can I do?

    Hi,
    This issue can be caused by the temporary files, sometimes Outlook may not handle its temporary file folders well, so cleaning out the folder may solve this issue.
    We can follow the steps in this link to empty the temp folder:
    http://www.howto-outlook.com/faq/securetemp.htm
    Hope this can help you.
    Regards,
    Melon Chen
    TechNet Community Support

  • How can I disable iMessages from archiving messages and attachments?

    I noticed while browsing ~/Library\Messages/ that iMessages has been archiving my messages (Archive folder) and saving attachments (in a separate Attachment folder). Under the settings for iMessages on OS X 10.8.2 Mountain Lion, I don't see any options to disable this. The only thing close to that is already unchecked: Save history when conversations are closed.
    Any ideas why iMessages is saving all this information? How do I disable it? My concern is that it's going to keep accumulating data overtime. I don't want to keep having to go back in there and delete those two folders constantly.

    Hi,
    This somewhat date back to the way iChat's Saved Chats were once Stored.
    At iChat 5 (in Snow Leopard) you could choose to see the last chat - (when opening an new chat with a person you had chatted with before) or parts of the Last Chat in terms of the Last so many IMs.
    Example Pic of iChat 5's Prefs
    Since then the management choices of the Save Chats has changed in both iChat 6 and Messages.
    Messages stores Chats two ways if they are iMessages.
    You can elect to Save them in Messages > Preferences > Messages.
    It also store the chat.db and other databases items which includes the Attachment items
    The chat.db is the bit that fill in the "history" if you iMessage the same person even if you are not saving the Chat in a formal sense in the App's Preferences.
    This is irrespective if your delete the Conversation from the Messages main window.
    How big these Databases get obviously depends on your iMessages usage.
    Striker's link seems to be about a similar issue on an iPhone (I presume it transfers to other iOS devices) but I am not sure that it is relevant in this situation.
    Edit.
    I should have been clear that you cannot change the database behaviour.
    9:49 pm      Sunday; October 6, 2013
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.4)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously
    Message was edited by: Ralph Johns (UK)

Maybe you are looking for