How to set content type while sending an email?

Hello,
I want to set content type text/html while send an email using org.apache.commons.httpclient api. I am using MultipartPostMethod method. and i am set using object of multipartpostmethod like post.
and post.setRequestHeader("Content-Type","text/html").
but it wont work.
so please give me a proper solution.
example::
MultipartPostMethod post = new MultipartPostMethod("url");
post.addParameter("msgbody","html message");
post.setRequestHeader("Content-Type","text/html");
Regards,
Bhavesh Kharwa

Actually, I'm writing a "HashMap" from servlet to applet. I have used your suggested content type "application/octet-stream" and another "appication/x-java-serialized-object" to try it. But in applet side, when I use (HashMap)in.readObject(), it always gives me a exception as:"java.util.HashMap; IllegalAccessException". Why?
Thankd.

Similar Messages

  • I download itext  for convert jsp to PDF. How to set content type for PDF.

    I download itext for convert jsp to PDF. How to set content type for PDF. I try
    <%@ page contentType = "application/pdf;charset=TIS-620" %>
    , but the page does not PDF.
    Thank.

    PDF files are usually binary files, JSPs are not well-suited for binary content.
    (If you download the result of your JSP you'll see that it is not a valid PDF file; it will have probably a lot of whitespace and linefeeds, that will choke your PDF reader.). The first few characters must be
    "%PDF-" without whitespace.
    You can try using PDF files encoded as text - check if you can use text-encoded PDFs in iText.
    Try using a Servlet instead.

  • How to set content type in SOAP AXIS sender adapter

    Hi All,
    I am trying to fetch the data from an URL which has special characters(like Ä, ï) using SAP PI - SOAP AXIS adapter. I am facing the below error in the channel.
    “error during receive: java.io.UnsupportedEncodingException: charset: utf-8”
    I need to set the content type as ISO-9958-1 but there is no such option present in the SOAP AXIS sender Adapter. Please let me know if there is any way to set the content type and fetch the data successfully.
    Thanks,
    Konda

    Hi Sudha,
    I have tried textcodepageconversion, Message
    Transformation and Annomizer beans but didn't help and this error is in sender SOAP AXIS adapter.
    Thanks,
    Konda

  • How to set content-type for outbound mail in BCS

    Hey everybody,
    can anybody please give me a hint how to set the content-type for outbound email in ABAP using BCS to send mail.
    By default the content tyoe is set to text/html. I need other.
    Best regards
    Roman

    //add related mutip-part to combine parts
    MimeMultipart multipart = new MimeMultipart("related");
    //attach a pdf
    messageBodyPart = new MimeBodyPart();
    fds = new FileDataSource("h:/something.pdf");
    messageBodyPart.setDataHandler(new DataHandler(fds));
    messageBodyPart.setFileName(fds.getName());
    multipart.addBodyPart(messageBodyPart);
    //add multipart to the message
    message.setContent(multipart);
    //send message
    Transport.send(message);

  • How to set Content-Type of attachment?

    Does anyone know how I can set the Content-Type of an attachment of an outgoing mail?
    I use Apple Mail, and with one correspondent I have this annoying problem that he never receives any excel or word attachments that I send (and possibly other ones, too).
    Our support now says that I should try to set the Content-Type
    of the excel attachments to "Content-Type: application/vnd.ms-excel".
    Apple Mail seems to set it to
    "Content-Type: application/octet-stream"
    and they think that attachments with this content-type might get blocked by the mail server of my correspondent.
    Any suggestions, ideas, etc., will be appreciated.
    Best regards,
    Gabriel.

    Thanks a lot for your test.
    Unfortunately, I get
    Content-Type: application/octet-stream;
    when I try to send an excel attachment to myself.
    Below is the beginning of the email (in "source" format).
    Any ideas why you get the correct mime-type, but I don't?
    Regards,
    Gabriel.
    ---------- beginning of email
    Return-Path: <[email protected]>
    Received: from [80.128.100.143] (account xxxxxxx HELO [192.168.2.100])
    by tu-clausthal.de (CommuniGate Pro SMTP 5.2.4)
    with ESMTPSA id 35503032 for [email protected]; Mon, 30 Jun 2008 21:59:05 +0200
    Message-Id: <[email protected]>
    From: Gabriel Zachmann <[email protected]>
    To: Gabriel Zachmann <[email protected]>
    Content-Type: multipart/signed; boundary=Apple-Mail-13-325543015; micalg=sha1; protocol="application/pkcs7-signature"
    Mime-Version: 1.0 (Apple Message framework v924)
    Subject: test
    Date: Mon, 30 Jun 2008 21:59:04 +0200
    X-Mailer: Apple Mail (2.924)
    --Apple-Mail-13-325543015
    Content-Type: multipart/mixed;
    boundary=Apple-Mail-12-325542957
    --Apple-Mail-12-325542957
    Content-Disposition: attachment;
    filename="Kostenabfrage AVILUS Gesamtinklusive_TPxyz 080606.xls"
    Content-Type: application/octet-stream;
    x-mac-creator=5843454C;
    x-unix-mode=0644;
    x-mac-type=584C5338;
    name="Gesamt.xls"
    Content-Transfer-Encoding: base64

  • Urgent: How to set content type on upload depending on target folder?

    Hi,
    i have to set the content type of a file uploaded via SMB depending on the folder the file is placed in. All files placed below a certain root directory have to be of my custom content type. All others should be stored as documents of type "Document". Is there an easy way to accomplish this task? I can't assume any specific file extensions and can therefore not register my custom content type to that extension.
    Any hints are welcome.
    Thanks.

    Hi,
    i have to set the content type of a file uploaded via SMB depending on the folder the file is placed in.All files placed below a certain root directory have to be of my custom content type.
    +++ Use an agent to verify the name and extension using the IfsEvent class and EVENTTYPE_CREATEINSTANCE
    All others should be stored as documents of type "Document". Is there an easy way to accomplish this task?
    +++ Those that aren't your custom content type move to a different folder using the agent.
    I can't assume any specific file extensions and can therefore not register my custom content type to that extension.
    +++I've found that registering content type only really affects things like how a browser knows what kind of file it's downloading/looking at (mime type) or how a renderer knows how to render it.
    Any hints are welcome.
    Thanks.

  • How to set content type for a JSF page

    Hi,
    I want to know is there any way we can specify the content type of a JSF page, like in JSPs we have the page attribute <%@ page contentType="application/vnd.ms-excel" %>
    In JSP we can create a html table with values and if we specify the contenType as application/vnd.ms-excel, we would get an excel file generated.
    But do we have something similar to this is JSF, as I am using Facelets I cannot use page directive in the xhtml file.
    I tried setting the content type in MangedBean's action as follows
    ((HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse()).setContentType("application/vnd.ms-excel"); but it did'nt work.
    Thanks in advance.

    //add related mutip-part to combine parts
    MimeMultipart multipart = new MimeMultipart("related");
    //attach a pdf
    messageBodyPart = new MimeBodyPart();
    fds = new FileDataSource("h:/something.pdf");
    messageBodyPart.setDataHandler(new DataHandler(fds));
    messageBodyPart.setFileName(fds.getName());
    multipart.addBodyPart(messageBodyPart);
    //add multipart to the message
    message.setContent(multipart);
    //send message
    Transport.send(message);

  • How to set content type in servlet?

    Hi, there,
    I'm writing a servlet to use ObjectOutputStream to return an object to applet. How can I set this content type in servlet?
    Thanks.

    Actually, I'm writing a "HashMap" from servlet to applet. I have used your suggested content type "application/octet-stream" and another "appication/x-java-serialized-object" to try it. But in applet side, when I use (HashMap)in.readObject(), it always gives me a exception as:"java.util.HashMap; IllegalAccessException". Why?
    Thankd.

  • How to set content type for the attachment?

    Hello Everybody,
    I was trying to do the following in my send mail program:-
    1. I am making a file using FileWriter:
    FileWriter fw = new FileWriter(f);
    fw.write(str);
    2. I now want to attach this file with my mail. but before that I want to set the Content type of this as "application/smil". and trying the following code:
    mimebodyparts[0].setContent(fds[0],"application/smil");
    As this is a new MIME type perhaps I need to change the mailcap file. I found the same in the activation jar package but thought instead of chagning the default file i tried putting following code in my program:
                  File capfile = new File("simple.mailcap");
                  if (!capfile.isFile())
                        System.out.println("Cannot locate the \"simple.mailcap\" file.");
                        System.exit(1);
                  CommandMap.setDefaultCommandMap( new MailcapCommandMap(new FileInputStream(capfile)));
    and in simple.mailcap file put the following value
    application/smil;;     x-java-content-handler=com.sun.mail.handlers.application_smil  but I am still getting the following error:
    javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/smil
    Can somebody Please help to sort this out.
    regards,
    Arun

    //add related mutip-part to combine parts
    MimeMultipart multipart = new MimeMultipart("related");
    //attach a pdf
    messageBodyPart = new MimeBodyPart();
    fds = new FileDataSource("h:/something.pdf");
    messageBodyPart.setDataHandler(new DataHandler(fds));
    messageBodyPart.setFileName(fds.getName());
    multipart.addBodyPart(messageBodyPart);
    //add multipart to the message
    message.setContent(multipart);
    //send message
    Transport.send(message);

  • Set content type in respone

    Hi,
    I am using velocity model and to set the content type of response as csv report i am setting content type of response as
    $response.setContentType("application/vnd.ms-excel")
    This stmt opens up open-save download dialog box. But the problem is a new internet browser window also opens up. I want to hide this newly opened browser till i click on open button.
    How i can hide or disable this IE window.

    Ritu,
    U specified only content type , try to specifiy attributes like attachment where u can rid of the IE explorer.
    if u have any other doubts u r most welcome giving me a mail [email protected]
    Thanks.
    Sravan

  • How to Keep Content Types Current with Updated Data

    Let’s say that I have four content types—content type 1, content type 2, content type 3, and content type 4—all based on the same list, say list A.
    Each content type has its own workflow.
    When the workflow for content type 1 is completed, the data is saved to an individual item, say item Z, in a separate list, list B.
    When the workflow for content type 2 is completed, the data is saved to the same item (item Z) in list B. The reason that there are two lists is that the creation of content types causes new items to be created, but the each
    new item must reference data from the previous item. That means that data has to be copied from the first item to the second item. But what happens to the data in the second item when data from the first item is changed? The solution is to have a single item
    in another list to which all content types write their data.
    What I need to know is how can all the content types retrieve data from list B when those content types are based on list A? For example, let's say that content type 3 uses data originally input through content type 1. As the
    user inputs and saves data through content type 3 he sees data that had been originally input through content type 1. Another user then accesses content type 1 to update and save data through it. When content type 3 is opened again that user will not see the
    updated data entered through content type 1 because it is tied to a different item. The solution seems to be for all content types to save their data to the same item in another list. But then how can those content types be designed so that when they open
    they show updated data from List B when those content types are based on List A?
    Other applications have the notion of a folder containing all the up-to-date data fields. Another way to look at this problem is to state what SharePoint 2007 does to mimic the notion of a folder.

    Thanks for responding, but I don't think that the solution provided solves my problem. What you described will keep the item in List B in sync with the changes made to List A. However, the content types from List A will not be in sync when they are opened
    from List A. Say content type 1 makes changes to various fields. When content type 3 opens it displays some of the fields that content type 1 changed; however, content type 3 and content type 1 by definition display different items--and those items are not
    in sync. Either I have to copy the updated item from List B back to the related items in List A or there has to be another solution.
    Is it possible to have a workflow update all the items in a list based on a key field whenever changes are made to that item. Say content types 1, 2, 3, and 4 already exist and each refers to a different item in List A, but they are "tied" together
    by a key field. When content type 1 is reopened and changes are made, is it possible to iterate over the items in a list to find other items whose key field matches the key field from content type 1? If so, then when matching items are found the fields in
    them can be updated by the same changes made to content type 1.
    If this latter scenario is possible, how is that iteration set up in a SharePoint 2007 workflow? Thanks again.

  • Document Set Content Type Workflow

    I have a document library in Share Point 2013 that is using Document Sets.  I need to set up a workflow under the document content type that would send an e-mail if documents have not been uploaded by a specific due date in the document set.  Any
    Help will be greatly appreciated.

    Hi,
    Based on your description, my understanding is that you want to send an email if there is no document uploaded to the document set by a specific due date in the document set.
    I recommend to create retention policy on the document set content type in the library to start the workflow at the due date.
    The workflow can be created as the image below:
    Firstly, get the max id in the library for using in the loop condition in the workflow:
    You can follow the link below for details:
    http://social.technet.microsoft.com/Forums/en-US/a8a890b5-f5fb-447f-b96f-9f3abdb7e178/forum-faq-sharepoint-2013-extracting-values-from-a-multivalue-enabled-lookup-column-and-merge?forum=sharepointgeneral
    Secondly, we need to loop through the items in the library and then check if there are documents(including folders)
     existed inside the document set which is called text for example.
    Please change the string “/sites/victoria/lib set/” in the Replace Substring in String step to be the relative URL of your library and make sure that there is a space before the document set name in the if condition in the workflow as the image below shows:
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • How to set field type choice using csom (c#)

    I have a field type: Choice (menu to choose from) which is not multichoice. How do I set a value?
    I have found code for multiple choice but it doesn't seem to work for single choice.

    Hi,
    The following code snippet for your reference:
    newListItem["ChoiceFieldName"] = "ChoiceValue";
    newListItem.Update();
    clientContext.Load(newListItem);
    clientContext.ExecuteQuery();
    If you are assigning a Value which is not in the Choice Column, You need to create a choice value then assign it to the item.
    More information is here:
    http://sharepoint.stackexchange.com/questions/124999/how-to-set-field-type-choice-using-csom-c
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How to set Content Set from 'Parallel' to 'Sequential' in Report Manager?

    Dear All,
    How to set Content Set from 'Parallel' to 'Sequential' in Report Manager?
    Thanks,
    Jackie

    Sorry, Please ignore, thanks...

  • How to setting Content Presenter?

    I dont want the message show up when I move the mouse on the link, how to setting Content Presenter?
    [https://communities.oracle.com/portal/server.pt/gateway/PTARGS_0_193021_269_216_224_43/http%3B/collaborationrs%3B7005/collab/docman/download/584917/0/0/0/]

    Hi Yannick,
    Going through the links which you have provided and will come back to you I face any problem.
    Before going through the link I would like to know how to get content from ucms from specifying a query rather than getting from the entire folder.
    Yes I am aware similar to the folder option you can specify a query but need help on writing a query and what parameters need to be mentioned in the query.
    One more doumb question about where content presenter taskflow is present in the jdev so that I can drag and drop on my portal page.

Maybe you are looking for

  • Mid 2010 MacBook pro gray screen beeps no startup

    Hello, My mid 2010 MacBook pro will not startup. What I get is the startup chimes with white or gray screen. Then some beeping and clicking starts. Will not boot remotely from FireWire drive. I'm thinking it might be ram based on what I have read so

  • Using a different webcam with Intel iMac with built-in isight cam.

    Hi...I hope someone can shed some light on this. I have an intel core duo iMac 20 with built-in isight. I use Yahoo Messenger (the new version) and have no problems getting my isight to work with it. For most circumstances, the built-in isight is fin

  • Problem in accessing CD-ROM in LINUX?

    Hello All, I have installed VMware on my laptop and installed Oracle Enterprise Linux on a virtual machine.Now i want to install oracle 10g.How i can access the CDROM in linux so that i can copy the oracle 10g software from CD to a directort in linux

  • Missing toolbar

    I am running CS6 64 bit on Windows 7. I see in book illustrations and on-line tutorials that there is a tool bar below the menu bar and above the selected tools option bar with some icons one of which is 'arrange windows' I do not have that toolbar v

  • Doubts on JDBC & FIle

    1.  IN A DATABASE -> IDOC scenario, if a reverse scenario, when ever an idoc is triggered it gets updated automatically into DB because of the ALE settings we do. But when DB-> r/3, how does this automation takes place. i mean.. when ever a new recor