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);

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 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);

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

  • 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

  • How to change content-type in receiver mail adapter

    Hi,
    I have receiver mail adapter for sending XML file as attachment in the mail. My partner expects to receive mail with content-type: text/xml, but XI sends Content-Type: application/xml. Please advise how I can change content-type to text/xml.
    Thank you
    Lev

    hi,
    try MessageTransformBean
    Transform.ContentType
    http://help.sap.com/saphelp_nw04/helpdata/en/57/0b2c4142aef623e10000000a155106/content.htm
    also shown in my blog:
    /people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • How to set expiry date for a mail account?

    Hi there, i'm new in Messaging Server, need help here on how to set an expiry date to a specific mail user since the mail user will be just a temporary mail user. Instead of deleting manually, is there any smarter way of doing it?

    Directory Server can be set to exipre a password, indeed. That will prevent the user from logging in, when it happens. There will be no warning, or anything like that.
    The account will still be on the server, and the mailbox will still contain mail. It will still receive mail.
    If you want to turn an account off, you will have to make some arrangement outside Messaging Server for automating it.
    You can use any kind of program you like to set the ldap attribute "mailuserstatus" to "inactive", or even "deleted" as you wish.
    You can use java, "c", or any other programming tools you like. Messaging Server and Directory Server aren't written in Java, anyway.

  • 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 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 MIME type for JNLP in Windows2000 IIS

    Hi!
    I try to set up my windows 2000 IIS's MIME type for JNLP to test java web start, but I have no idea how to set
    the MIME type. Can anybody help me???
    Best wishes

    In IIS v4 which comes with the Windows NT4 option pack, you right click the web page you are working with, select properties, then go to the HTTP Headers tab. At the bottom there's a button labelled File Types in the MIME Map section.
    After you've clicked that, you can add the two mime types you need;
    Associated Extension MIME Type
    .jar application/x-java-jar-file
    .jnlp application/x-java-jnlp-file
    I'm assuming that it is the same in W2k/IIS5.

  • How to set security type for lenovo working with hotspot?

    How to set wireless security type for lenovo laptop working with hotspot?
    Since I can connect with the other laptops except this brand.

    //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 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 encoding type for e4x result

    I have a application with front end Flex and Server side App
    in Java. I am using HttpService to communicate to Java application
    (Web). I am sending data in xml format to flex and parsing it as
    e4x format. From service side I am setting the charset as
    windows-1252 and xml encoding is also windows-1252. In Flex I am
    getting some junk characters. But When I post the same http request
    from browser, I am able to view the characters with expected
    encoding.
    Can anybody clue me on getting xml data in required encoding
    type (charset) in Flex.
    Thanks in Advance,
    Gokul Ram.T

    The message is old, but the problem is opened and I believe that many people have troubles with getting appropriate encoding in e4x result.
    I have excactly same problem like Gokul, only difference is that I am trying to get ISO-8859-2 charset. HttpService deffinition looks like this:
    var source:HTTPService = new HTTPService();
    source.method = "POST";
    source.resultFormat = "e4x";
    source.contentType = "text/xml; charset=ISO-8859-2";
    source.headers = {"Content-Type": "text/xml; charset=ISO-8859-2"};
    So I suppose that everything what can be set is set. But still in result XMLthere are no national chars. I also get correct XML when I request it in browser, but requesting by Flex and HttpService makes problem.
    Does anyone have same problem and find out something to handle this?

  • Mail? How to set auto check for new mail?

    Ok, I want to be able to turn on my mac, and whenever a new mail arrives it play a sound or pop up etc..
    Now I made the setting in mail Preferences>General>Check for new mail every 5 min, and I tested by sending myself a email, but it didn't make any notify sounds or anything..
    So my question is do I have to open Mail at startup for this to be able to work? "Open at login" or any other ?
    Thanks
    Message was edited by: nubbic

    To start Mail automatically, go to System Prefs>Accounts. Highlight your account then click on the login items tab. Add Mail to the list.
    As for sounds, that is under the Mail prefs. Make sure your sound is turned up.

Maybe you are looking for

  • Need experience on FORM Template for custom system development

    Hi, I need to use FORM BUILDER+Application Server to do development for a custom system(No relation to EBS). There are many screens need to development, and I want to make these screen look like in the same style, I need to a TMPLATE.fmb to guide dev

  • How to reformat iPod classic

    My iPod Classic told me to reformat immediately. I have tried to re-set. How do I re-format? I also get a message saying my iPod does not have permission to sync with my Mac. I've had both for 2+ years and sync'd them many times. Is this associated w

  • Bug in full screen slide show: Speed-values under 1.0 don't work, they will be zero. Maybe a german problem because of ","?

    I wan't to do a full screen slide show with changing images under one second. But this doesn't work because every value under 1 will be 0. Maybe this is a german problem because we use "," instead of a ".". But I can't use ".", the field doesn't allo

  • File extension

    Does anyone know how I can have the file extension visible after the name. When I'm viewing the images by thumbnail view I would like to see the file extension. Right now it only shows the file name. I would like to know if I'm looking at a .tif .jpg

  • Creating Queries Programmatically

    Hi, I need to create the queries programmatically using the APIs in my 7.1 Laptop webdynpro application. when I try to use the class QueryRuntime to instantiate the query, the project is not able to reference to the package com.sap.ip.me.api.persist.