Multipart/mixed content: html, pdf

Hi.
I have a problem sending multipart content back to a browser through the response object.
What I want is to send a "Please be patient" html page while a pdf is created and send it as a second part as soon as it is created and can't get it to work.
The problem is, the pdf just does not show up. The html sent first is removed from display, the plugin starts but then nothing happens and I end up with a blank browser window.
Code snippet:
response.setContentType( "multipart/mixed;boundary=" + boundary );
ServletOutputStream outStream = response.getOutputStream();
response.addHeader( "MIME-Version", "1.0" );
outStream.println( "" );
outStream.println( "--" + boundary );
response.addHeader( "Content-Type", "text/html" );
response.addHeader( "Content-Transfer-Encoding", "chunked" );
outStream.println( "" );
outStream.println( "<html>" );
outStream.println( "<head><title>Supplier Info</title></head>" );
outStream.println( "<body>" );
outStream.println( "<p>Please be patient...</p>" );
outStream.println( "</body></html>" );
outStream.println( "" );
outStream.println( "--" + boundary );
outStream.flush();
// create pdf and write it into a byte array called 'result'
response.addHeader( "Content-Type", "application/pdf" );
response.addHeader( "Content-Transfer-Encoding", "chunked" );
response.addHeader( "Content-Disposition", "inline" );
outStream.println( "" );
System.out.println( "result.length: " + result.length ); //result contains data!
outStream.write( result );
outStream.println( "" );
outStream.println( "--" + boundary + "--" );
outStream.println( "" );
outStream.flush();
Please could somebody tell me what's wrong with my code? Am I missing something?
My environment is Win2k, Borland JDev 3.2.3, Mozilla 1.0.
TIA
Ralf Steppacher

try this
Response.reset()
before setting the content type
prash

Similar Messages

  • Mail Problem with multipart/mixed Content, "empty mails" via IMAP

    I do need some help.
    Here is my setup. I have a OSX Mountain Lion Server with the mail service running. fetchmail is collecting mail from a pop account. I have two Mac clients - one with Outlook for Mac, one with Apple Mail,
    Everything is fine exept...
    ... if I receive a mail from an Exchange Server with a PNG-Image in the signature (e.g. a company logo) then...
    ... this mail will be displayed as an empty mail. Correctly spoken, the mail header is there, but the mail body ist not shown. The body is there - I can see it if I swich to the raw view in mail.
    So I tried to figure out what the reason might be. I also tried several ideas from other discussions here - without success.
    This error is concerning only mails with the Content-Type: multipart / mixed - coming from Exchange Servers. The mail body is not displayed. It seems to be that something is corupptung the IMAP Envelope of these mails.
    - Is it a security problem?
    - Is it a filtering problem?
    - Is it a settings problem in Apple Mail and Outlook for Mac?
    - Is it a settings problem in fetchmail?
    I don't know... I think it is a settings problem in the main.cf - but I don't know what to do.
    Can anybody help???
    Kind regards,
    Robert.

    Problem solved!
    It was a bug in fetchmail. Try out the version 6.3.26. You have to compile fetchmail yourself... it is not a great thing. And everything is working.
    http://developer.berlios.de/project/shownotes.php?group_id=1824&release_id=19356
    Robert

  • Share point 2010 - Content html , pdf - Books website - View , Paging

    Please note here book content means not pdf or word.
    Here Book content constructed with Html + CSS + Images.
    Each html is one page .
    Example: A Top-level folder with Book name inside it contains three folders –
    Html Pages, CSS, Images, JavaScript.
    A book can contain 200 to 300 or more html pages in addition to assets
    Book Types:   Biographies, Business, Children books , Cooking , History , Romance
    Expected Functionality:
    View book in browser
         [Page number toolbar, Search Page
    content, Search page  Number]
    Edit Book by admin
    Download
    Print
    My thoughts on above question are:
    Crate a folder for each book in site pages libraries programmatically.
    I will implement wikipage/Publishing page from each html programmatically.
    Upload assets like images, css into site assets library programmatically
    Any other thoughts to implement same in Sharepoint 2010 with programmatically   .
    Please consider also capacity or memory requirement s of Sharepoint site collection for all books and provide your thoughts on new design 
    Best Regards Showkath

    What you are suggesting should not cause much load on any SharePoint server.  Pages, even 300 of them, are just HTML that are formatted with CSS and images in your design.  As such, the capacity to store, index and deliver such content for thousands
    of books is well within SharePoint's ability.  Where capacity will become a factor is consumption load i.e. how many users you have loading pages at the same time.  Even at that though, given the content is books, it can be assumed users would load
    a page and then read it's contents, even if just skimming it.  Thus the load placed on SharePoint would be much less than say a user browsing around a site looking for some files etc.  Capacity planning for consumption load would be the main effort
    I would recommend in your endeavor.
    Start here: 
    http://technet.microsoft.com/en-us/library/cc261700(v=office.15).aspx
    I trust that answers your question...
    Thanks
    C
    |
    RSS |
    http://crayveon.com/blog |
    SharePoint Scripts | Twitter |
    Google+ | LinkedIn |
    Facebook | Quix Utilities for SharePoint

  • Multipart/mixed and multipart/relative Content type probs

    I tried to create a page from a servlet by using the multipart/mixed
              Content-type.
              All that is displayed inside the browser is the actual code including the
              headers for the single parts of the page. I also checked it on the byte
              level, getting the same results.
              Does anybody have an idea ?
              Thank you very much ,
              Tom
              

    Are you setting the content type prior to each response (i.e.
              out.println("Content-type: text/html\n");)?
              Below is an example (untested, but should work):
              // Global constants
              static final String BOUNDARY_STR ="Joe";
              static final String BOUNDARY = "--"+BOUNDARY_STR;
              static final String BOUNDARY_END = BOUNDARY+"--";
              // Inside of doGet
              res.setContentType("multipart/mixed;boundary="+BOUNDARY_STR);
              ServletOutputStream out = res.getOutputStream();
              // First Response
              out.println(BOUNDARY);
              out.println("Content-type: text/html\n");
              out.println("<html>\n");
              out.println("<head>\n");
              out.println("<title>First Response</title>\n");
              out.println("</head>\n");
              out.println("<body>\n");
              out.println("<h1>First Response</h1>\n");
              out.println("</body>\n");
              out.println("</html>\n");
              out.println(BOUNDARY);
              out.flush();
              // Second Response
              out.println(BOUNDARY);
              out.println("Content-type: text/html\n");
              out.println("<html>\n");
              out.println("<head>\n");
              out.println("<title>Second Response</title>\n");
              out.println("</head>\n");
              out.println("<body>\n");
              out.println("<h1>Second Response</h1>\n");
              out.println("</body>\n");
              out.println("</html>\n");
              out.println(BOUNDARY);
              out.flush();
              // Done
              out.println(BOUNDARY_END);
              out.flush();
              Thomas Schmitt wrote in message <[email protected]>...
              >I tried to create a page from a servlet by using the multipart/mixed
              >Content-type.
              >All that is displayed inside the browser is the actual code including the
              >headers for the single parts of the page. I also checked it on the byte
              >level, getting the same results.
              >Does anybody have an idea ?
              >Thank you very much ,
              >Tom
              >
              >
              

  • Support for multipart/mixed on iOS Mail

    I subscribed what here is called "Certified Electronic Mail" (italian: PEC - Posta Elettronica Certificata), which has the same value as registered mail.
    When I receive an email, I can see all the metadata, but not the message itself, which should be an .eml attachment.
    In the footer there's only a message which tells (it's a translation): "This message cannot be shown because of the format used. Ask the sender to send it again using a different format and/or a different email client.
    multipart/mixed".
    Is it true that iOS cannot read multipart/mixed messages?
    My PEC provider uses this format only.
    Thank you.

    Hi Paolo,
    I work for an IT company whose focus is on mailing and PEC systems, so after reading your post I've done some tests with my own PEC accounts.
    I've noticed that iOS (test platform was 4.3.3 on an iPhone4) has indeed some problems in reading PEC messages, and this seem to be connected with the multipart/mixed content-type. If you do a quick search in the forums, you will find that this type is infact not supported by iOS , and this is why we are getting the error. During my tests, depending on the PEC Provider that hosted the sender, I got different behaviours: sometimes I didn't get any error at all, but still I was unable to see the postacert.eml attachment containing the text of the original message.
    Unfortunately the PEC regulations in Italy force the provider to build the message using this multipart/mixed structure, so I guess we will not be able to read PEC messages on our iPhones until Apple fix this.
    By the way, I am going to do some more tests to understand why I am getting such different results depending on the provider. I'll keep you updated should I find a workaround.
    Regards,
    Claudio Tassini
    Tech Advisor @Babel Srl

  • Why isn't multipart/mixed supported in Mail?

    If I'm not mistaken multipart/mixed content types aren't supported in Mail.app and I'm told I should be using multipart/alternative despite the difference in the actual content for each part. In my case I have some text content and an rfc822 context so I figure I'm typing the thing correctly since Mail.app under OSX displays the rfc822 inline but the phone's Mail client simply complains.

    Just wanted to echo this post. Given that a lot I people keep on sending multipart/mixed messages, I have to say that simply not displaying them is very disappointing.
    The problem is that there are no alternatives whatsoever. Ok mail.app does not support it, but at least let the user download the source. I had my electronic tickets sent to me in such a message and had to figure out how the henk and when I can get my fligt having a dumb mail.app telling me that it won't download the rest. Come on!!! That's so frustrating.
    In my experience about 10% of mails are multipart mixed. Do you see me telling to my customers to use another mail programme? Please improve this one.

  • Unable to read email content of type multipart/mixed....

    Hi i have written following code to read text content form the multipart email content type,
    but when i say
    if (content instanceof Multipart){
    System.out.println("############ Content Type is Multipart ############ ");
    messagePart = ((Multipart) content).getBodyPart(0);
    }the flow is not going into the if condition,
    bellow is the detailed code and the output in the console, you can check with the SOPs
    Part messagePart = message;
    content = messagePart.getContent();
    System.out.println("############ : " + content);
    System.out.println("############ START MESSAGE BODY ############");
    System.out.println(content);
    System.out.println("############ END MESSAGE BODY ############");
    if (content instanceof Multipart){
         System.out.println("############ Content Type is Multipart ############ ");
         messagePart = ((Multipart) content).getBodyPart(0);
    String contentType = messagePart.getContentType();
    System.out.println("############ CONTENT TYPE     : " + contentType);
    System.out.println("############ CONTENT TYPE     : " + contentType);
    if (contentType.startsWith("text/plain")) {
         System.out.println("############ Content Type is text/plain ############");
         InputStream is = messagePart.getInputStream();
         BufferedReader reader = new BufferedReader(new InputStreamReader(is));
         String thisLine = reader.readLine();
         while (thisLine != null) {
              actualMsg = actualMsg + thisLine + ".";
              thisLine = reader.readLine();
    System.out.println("############ SMS CONTENT      :" + actualMsg);
    System.out.println("/**********************Passing to E2SConverter********************/");
    And the output for the same
    Stack Trace*** Check for new mails on Mail Server for Processing ***
    ########## Unread Msg Count      : 1
    ########## FROM           : [email protected]
    ########## SUBJECT           : RE: SMS-5000-9969413222-S1221654991804 [T20080917000CS010Z246]
    **************** Checking Subject Line ****************
    ******* GO AHEAD IS TRUE : EMAIL TO SMS CONVERTER *******
    ############ : javax.mail.internet.MimeMultipart@1a2760f
    ############ START MESSAGE BODY ############
    javax.mail.internet.MimeMultipart@1a2760f
    ############ END MESSAGE BODY ############
    ############ CONTENT TYPE     : multipart/mixed; boundary=22902610.1221655198503.JavaMail.javamailuser.localhost
    ############ SMS CONTENT      :
    /**********************Passing to E2SConverter********************/
    Please help me for the same.. its bit urgent...
    Thanks And Regards,
    Amie...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Yes,
    It's going into the if if block, but its giving me ClassCastException
    System.out.println("******* GO AHEAD IS TRUE : EMAIL TO SMS CONVERTER ******* ");
    Part messagePart = message;
    content = messagePart.getContent();
    System.out.println("############ : " + content);
    System.out.println("############ START MESSAGE BODY ############");
    System.out.println(content);
    System.out.println("############ END MESSAGE BODY ############");
    if (messagePart.isMimeType("multipart/*")) {
                   System.out.println("############ Content Type is Multipart ############ ");
                   messagePart = ((Multipart) content).getBodyPart(0); //GIVES EXCEPTION : ClassCastException at this line...
    String contentType = messagePart.getContentType();
    System.out.println("############ CONTENT TYPE     : " + contentType);
    See the Stack Trace..TAconnVect.size()25
    *** Check for new mails on Mail Server for Processing ***
    ########## Unread Msg Count      : 2
    ########## FROM           : [email protected]
    ########## SUBJECT           : SMS-5000-9969413222-S1221713640885 [T200809180003S070]
    ########## FROM           : [email protected]
    ########## SUBJECT           : SMS-5000-9969413222-S1221713740897 [T200809180004S070]
    **************** Checking Subject Line ****************
    ******* GO AHEAD IS TRUE : EMAIL TO SMS CONVERTER *******
    ############ : javax.mail.internet.MimeMultipart@1f7be7b
    ############ START MESSAGE BODY ############
    javax.mail.internet.MimeMultipart@1f7be7b
    ############ END MESSAGE BODY ############
    ############ Content Type is Multipart ############
    java.lang.ClassCastException: javax.mail.internet.MimeMultipart
         at com.interactcrm.SMSConverterClass.PollEmail.CheckEmails(PollEmail.java:327)
         at com.interactcrm.SMSConverterClass.PollEmail.run(PollEmail.java:98)
         at java.util.TimerThread.mainLoop(Unknown Source)
         at java.util.TimerThread.run(Unknown Source)
    - INFO : readMessage Checking for new messages in inbound table of ta database
    TAconnVect.size()25
    TAconnVect.size()25
    and Bellow is the internet header of the mail which i am trying to read.Received: from grameenphone.com ([10.10.29.153]) by neptune.grameenphone.com with Microsoft SMTPSVC(6.0.3790.3959);
         Thu, 18 Sep 2008 10:55:52 +0600
    Date: Thu, 18 Sep 2008 04:55:52 GMT
    From: [email protected]
    Subject: =?us-ascii?B?U01TLTUwMDAtOTk2OTQxMzIyMi1TMTIyMTcxMzc0MDg5NyBbVDIwMDgwOTE4MDAwNFMwNzBd?=
    To: [email protected]
    MIME-Version: 1.0
    Content-Type: multipart/mixed; boundary="20238918.1221131600666.JavaMail.SYSTEM.ipcc-test3"
    Return-Path: [email protected]
    Message-ID: <[email protected]>
    X-OriginalArrivalTime: 18 Sep 2008 04:55:52.0114 (UTC) FILETIME=[D35D2120:01C9194A]
    Edited by: Amie on Sep 18, 2008 10:29 AM
    Edited by: Amie on Sep 18, 2008 10:36 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Can't read Messages with Content-Type multipart/mixed

    For many years I have used „QuickMail Pro“, as my favorite Mail-Client. Now I had switch to Apple Mail. I hoped, to be more compatible to other „modern“ Mail-Clients. So could it be, that Apple Mail can not read Messages from Type <multipart/mixed>? I only see the Header-Information and instead of the Message-Text there is only an Error-Message:
    <Diese E-Mail kann aufgrund ihrer Formatierung nicht angezeigt werden. Bitten Sie den Absender, Ihnen die E-Mail erneut in einem anderen Format bzw. mit einem anderen E-Mail-Programm zu senden.
    multipart/mixed>
    Did anyone know a simple Way, to read this Messages.
    My old QuickMail has no Problem with this Type.

    Hi Ruchi,
    You need to use Java Mapping or UDF to create Multipart/Mime
    Check this excellent blog by stefan.
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/6321
    Also check this thread for your solution
    http://forums.sdn.sap.com/message.jspa?tstart=0&messageID=945095

  • 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>

  • Mail problem with long titles using utl_smtp / mixed content / attachements

    Hello,
    I'm having a problem with sending emails. The title as well as the body needs to be able to contain accented letters (é ç ...).
    For the body i got it working.
    And the title works fine too, untill the encoding passes a certain length, then goes all wrong and my mail header starts showing up in the mail body.
    Could anyone help me in finding a solution?
    Thanks in advance
    Below my code:
    DECLARE
       v_From       VARCHAR2(80) := 'test@localhost';
       v_Recipient  VARCHAR2(80) := 'test@localhost';
       v_Cc         VARCHAR2(80);
    -- long subject causing problems
       v_Subject    VARCHAR2(32000) := '123456789111111111111111111111118888888888888111111111111111991234567891111111111111111111111188888888888881111111111111119912345678911111111111111111111111888888888888811111111111111199';
       v_body       VARCHAR2(32000) := '<a href="#">tester</a><br><br>en nog wat éékes en ççkes';
       v_Mail_Host  VARCHAR2(30) := 'localhost';
       v_Mail_Conn  utl_smtp.Connection;
       crlf         VARCHAR2(2)  := chr(13)||chr(10);
    BEGIN
      v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
      utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
      utl_smtp.Mail(v_Mail_Conn, v_From);
      utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
      utl_smtp.Data(v_Mail_Conn,
    -- write header
        'Date: '   || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
        'From: '   || v_From || crlf ||
        'Subject: ' || utl_encode.MIMEHEADER_ENCODE(v_Subject) || crlf ||
        'To: '     || v_Recipient || crlf ||
        'Cc: '     ||  v_Cc || crlf ||
        'X-Mailer: Mailer by Oracle UTL_SMTP' || crlf ||
        'X-Priority: 1' || crlf ||
        'MIME-Version: 1.0'|| crlf ||       -- Use MIME mail standard
        'Content-Type: multipart/mixed;'|| crlf ||
        ' boundary="-----SECBOUND"'|| crlf ||
        crlf ||
    -- add message body
        '-------SECBOUND'|| crlf ||
        'Content-type: text/html; charset=UTF-8'|| crlf ||
        'Content-Transfer-Encoding: base64'|| crlf ||
        crlf ||
        utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw(v_body)))||
        crlf ||
    -- add csv attachment
        '-------SECBOUND'|| crlf ||
        'Content-Type: text/plain;'|| crlf ||
        ' name="excel.csv"'|| crlf ||
        'Content-Transfer_Encoding: 8bit'|| crlf ||
        'Content-Disposition: attachment;'|| crlf ||
        ' filename="excel.csv"'|| crlf ||
        crlf ||
        'CSV,file,attachement'|| crlf ||   -- Content of attachment
        crlf ||
        '-------SECBOUND--'                            -- End MIME mail
      utl_smtp.Quit(v_mail_conn);
    EXCEPTION
      WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
        raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;
    /

    Hi,
    I did not think the characterset and database would matter for this problem, but here is the info you requested.
    The database is an Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    The characterset : NLS_CHARACTERSET     AL32UTF8
    And i don't have a clue about the characterset of the operating system (not even sure what the operating system is), but i think that will be utf-8 aswell.
    I'm not sure what i did, to come over as rude, but i didn't mean to and i apologize for it.

  • Mixed content-type in email

    Hi,
    I want to send emails in html-format. However, some clents can't decode html, but includes the message as an attachment. In this case I would like to have a text that tells the reciever to open the attachment. I have tried to laborate with Content-type: multipart/mixed, but I haven't managed to get it to work. Someone having an idea about this?

    As an addition: I'm not totally sure what mail clients will do with it, but maybe you could use a structure like that:
    +----- multipart/alternative -------+
    |                                   |
    | +--- multipart/mixed -----------+ |
    | |                               | |
    | | +- text/plain --------------+ | |
    | | | save message              | | |
    | | +- text/html ---------------+ | |
    | | | contents                  | | |
    | | +---------------------------+ | |
    | |                               | |
    | +----- text/html ---------------+ |
    | | contents                      | |
    | +-------------------------------+ |
    |                                   |
    +-----------------------------------+Regards

  • Multipart/mixed mime problems with mail

    So from what I've gathered Mail has problems with multipart/mixed mime type emails.
    I wrote a PHP script that sends customers their orders as a PDF attachment as well as the order processing department.
    If Mail doesn't support multipart/mime what is the alternative to use in my mime type to make my emails work?
    Is there another content type that I should be using?

    john,
    how did u solve this?
    I'm doing byte by byte comparision of incoming response stream to construct different parts.....i'm wondering if there is any more effecient method..
    Thanks,

  • SSL, IE6, & "Mixed Content"

    I have a servlet that returns a PDF over SSL, like this (I'm using JSF):
    FacesContext faces = FacesContext.getCurrentInstance();
    try {
         HttpServletResponse response =
            (HttpServletResponse) faces.getExternalContext().getResponse();
         response.setContentType("application/pdf");
         response.setHeader(
              "Content-disposition",
              "inline; filename=\"MyFile.pdf\"");
         ServletOutputStream out = response.getOutputStream();
         out.write(login.getRole().getPrintfile(this));
         faces.responseComplete();
    } catch (Exception e) {
         System.err.println(
              "ERROR: ReportDetails.print() - "
              + login.getRole().toString());
         e.printStackTrace(System.err);
         faces.addMessage(null, new FacesMessage(e.getMessage()));
    }This works great on every browser I've tested...except for Internet Explorer. On IE, the user gets a prompt warning that the page contains both secure and non-secure content. As far as I know, that's simply not the case. If the user says not to display the non-secure content, the PDF comes up fine. If the user says go ahead and display everything, the PDF comes up fine. (In Acrobat Reader)
    If I go into IE's Tools|Options|Customize, and change "Display mixed content" from "Prompt" to "Enable" everything works fine, and there is no prompt. Curiously, if I change the setting from "Prompt" to "Disable" everything still works fine.
    This is annoying. I don't want my users to have to change the default IE settings. Can anyone point me towards a solution?

    Thank you for this thread (and to Google for finding it for me). The KB article solves this exact problem for me. However, I am doing this using IIS and ASP.NET. It is ironic that I came to a Sun/Java development site to solve a Microsoft-specific problem. :-)
    Yes, I'm using POST (it's a JSF form).
    Thank you for the suggestion. I did find a simple
    work-around, though.
    I found a Microsoft KB article (321532) here:
    http://support.microsoft.com/default.aspx?scid=kb;EN-US
    321532
    It says that there is a bug in IE that is fixed in the
    service packs, but that even after you apply the
    updates, you need to make sure your server sends
    "Accept-Ranges: bytes" in the HTTP response headers.
    I tried this, and IE pulled down the PDF, but Acrobat
    Reader claimed it was corrupt (again, and again...) I
    think there is a problem between Tomcat and Acrobat
    Reader using Accept-Ranges: bytes. (See
    http://www.mail-archive.com/[email protected]
    rg/msg57776.html)

  • How to open a file (*.html,*.pdf) in new browser using servlet

    Dear Friends,
    I am having some files (*.html,*.pdf) in local drive , im getting the path whichy includes dir name + file dynamically, im using the following code
    response.sendRedirect(response.encodeRedirectURL(file))
    this is displaying the file in same window, now i want open in new window is there any method except java script like window.open("URL");
    Thanks in advance....
    Thangavel

    Hi Balu !
    Thanks for u r reply ,
    this is html code ok
    <a onclick="view()" >View </a>
    im callinig view function in java script
    function view()
    window.document.formname.submit()
    so it will submit the action URL which given in form ok
    filename contains full path ok
    in server side im sending as i told previously encoderURL(file) ok
    but im given target="_blank" as per ur suggestion in anger tag like
    <a target="_balnk" onclick="view()" >View </a> tag
    it is opening in new window the content which is displaying in jsp but not file
    pls give ur valueable suggestion .....
    Thanks in advance...
    Thangavel

  • Working with mixed-content XML

    Am new to Flex 2 and AS 3 but well versed in XML and related
    technologies. This is my first time posting to the forum.
    I have a simple Flex application that loads an external XML
    file via HTTPService and binds the XML to some MXML form controls.
    This works well as long as the XML element contains simple text,
    but breaks when the element contains a mixture of text and other
    elements (e.g. mixed-content).
    <something>some text</something> (Fine)
    <something>some <b>bold</b>
    text</something> (Breaks).
    Just wondering if anyone has could point me to an example of
    a Flex application interpreting mixed content XML. I've looked at
    various forums and in books and there isn't a lot on the subject
    from what I can see. Most of the XML examples I've found use flat,
    database/table-style XML which don't suit my purposes.
    Thanks
    Heather

    Let's not give up here. The problem is that you have HTML
    inside of an XML structure and the HTML, because its syntax is just
    like XML, cannot be distinguished by the XML parser. The proper way
    to get your HTML embedded in the XML is to use CDATA. So whoever
    created the XML didn't take that into account.
    I gave this a bit more thought. This will work ONLY if the
    HTML inside of the XML is always complete. No <br> tags
    without a </br>; no <p> without </p> etc. as that
    won't be readable by the XML parser.
    Once you've got your XML structure in Flex, you can get all
    of the <something> items like this:
    var somethings:XMLList = xmlvar.something;
    Now you have an XMLList - an Array of XML structures. This
    means somethings[0] is "some text" but somethings[1] is an XML node
    with a sub-structure which includes the <b> node. I hope you
    are withme so far.
    Now try this: var sometext:String = XML( somethings[1]
    ).toString();
    The toString() method should flatten the contents back into a
    string and you can assign that to the htmlText property of the
    control.
    As I said, your XML has to be perfect for this to work. Or
    you have to convince the author(s) of the XML to use CDATA to
    enclose the HTML.

Maybe you are looking for