Problem sending a HTML page

How can i send a HTML by email??
When i am sending a HTML he shows the code in the mail instead of showing the HTML page??
Anyone knows how can i solve tyhis??

are you setting the content type to text/html? there are plenty of examples out there (and in here). run a search.

Similar Messages

  • How do i send an html page in java mail

    hi everyone, i have an problem while sending html page in my java mail application.Actually it's sending the html page correctly but the thing is it doesn't display the gif files . why so ? can anyone help me. i think its b'coz of the path problem.
    My requirement is like this :
    I would like to send an html page to some [email protected] from my local system . for that i have written one mail application which will build an html page which is also having some gif files. And these gif files are located in my local system. when i sent to some xyz user it's not displaying the gif files . How should i give the path for that gif files. pls help me regarding this. This is Urgent.
    Thanx in advance.
    by
    jjjavac

    hi , here with i have attached my program which will work fine . What u have to do is u have to specify ur smtp host address. from address and to address. And if u want to embedd the gif file u have to specify the gif file name. It will work only in outlook and hotmail. if u have anyother doubt let me know.
    import java.io.*;
    import java.util.Properties;
    import java.util.Date;
    import javax.mail.*;
    import javax.activation.*;
    import javax.mail.internet.*;
    import java.sql.*;
    import java.text.*;
    * @author Jeevan
    public class EmbeddingGif {
         StringBuffer sb = new StringBuffer();
         String line;
    public static void main(String[] argv) {
              new EmbeddingGif (argv);
    public EmbeddingGif (String[] argv) {
              String to, subject = null, from = "[email protected]",
              cc = null, bcc = null, url = null;
    //     String mailhost = null;
              String mailhost = "10.1.0.106";                    // SMTP host address
              String mailer = "SendHtmlMail";
              String protocol = "imap", host = null, user = "jeevan", password = "jeevan";
              String record = "g:/rbs/web-inf/classes/emailstore";     // name of folder in which to record mail
              boolean debug = false;
              BufferedReader in = null;
              int optind;
         for (optind = 0; optind < argv.length; optind++) {
         if (argv[optind].equals("-T")) {
              protocol = argv[++optind];
         } else if (argv[optind].equals("-H")) {
              host = argv[++optind];
         } else if (argv[optind].equals("-U")) {
              user = argv[++optind];
         } else if (argv[optind].equals("-P")) {
              password = argv[++optind];
         } else if (argv[optind].equals("-M")) {
              mailhost = argv[++optind];
         } else if (argv[optind].equals("-f")) {
              record = argv[++optind];
         } else if (argv[optind].equals("-s")) {
              subject = argv[++optind];
         } else if (argv[optind].equals("-o")) { // originator
              from = argv[++optind];
         } else if (argv[optind].equals("-c")) {
              cc = argv[++optind];
         } else if (argv[optind].equals("-b")) {
              bcc = argv[++optind];
         } else if (argv[optind].equals("-L")) {
              url = argv[++optind];
         } else if (argv[optind].equals("-d")) {
              debug = true;
         } else if (argv[optind].equals("--")) {
              optind++;
              break;
         } else if (argv[optind].startsWith("-")) {
              System.out.println(
    "Usage: SendHtmlMail [[-L store-url] | [-T prot] [-H host] [-U user] [-P passwd]]");
              System.out.println(
    "\t[-s subject] [-o from-address] [-c cc-addresses] [-b bcc-addresses]");
              System.out.println(
    "\t[-f record-mailbox] [-M transport-host] [-d] [address]");
              System.exit(1);
         } else {
              break;
         try {
         if (optind < argv.length) {
              // XXX - concatenate all remaining arguments
              to = argv[optind];
              System.out.println("To: " + to);
         } else {
              System.out.print("To: ");
              System.out.flush();
    //          to = in.readLine();
              to = "[email protected]";
         if (subject == null) {
              System.out.print("Subject: ");
              System.out.flush();
    //          subject = in.readLine();
              subject = "New Bill @ " + new Date ();
         } else {
              System.out.println("Subject: " + subject);
         Properties props = System.getProperties();
         // XXX - could use Session.getTransport() and Transport.connect()
         // XXX - assume we're using SMTP
              System.out.println("mailhost :"+mailhost);
              System.out.println("from :"+from);
              System.out.println("to :"+to);
              System.out.println("cc :"+cc);
              System.out.println("subject :"+subject);
              System.out.println("bcc :"+bcc);
              System.out.println("url :"+url);
         if (mailhost != null)
              props.put("mail.smtp.host", mailhost);
         // Get a Session object
         Session session = Session.getDefaultInstance (props, null);
         if (debug)
              session.setDebug (true);
         // construct the message
         Message msg = new MimeMessage(session);
         if (from != null)
              msg.setFrom(new InternetAddress(from));
         else
              msg.setFrom();
         msg.setRecipients(Message.RecipientType.TO,
                             InternetAddress.parse(to, false));
         if (cc != null)
              msg.setRecipients(Message.RecipientType.CC,
                             InternetAddress.parse(cc, false));
         if (bcc != null)
              msg.setRecipients(Message.RecipientType.BCC,
                             InternetAddress.parse(bcc, false));
         msg.setSubject(subject);
         collect(in, msg);
    //     msg.setHeader("X-Mailer", mailer);
    //     msg.setSentDate(new Date());
         // send the thing off
    //     Transport.send(msg);
    //     System.out.println("\nMail was sent successfully.");
         } catch (Exception e) {
         e.printStackTrace();
    public void collect(BufferedReader in, Message msg)     throws MessagingException, IOException {
                        BodyPart bp1=new MimeBodyPart();
                        String html="<H1>Hello from Jeevan</H1>";
                        html=html+"<img src=cid:mickey>";
                        bp1.setContent(html,"text/html");
                        MimeMultipart mp=new MimeMultipart("related");
                        mp.setSubType("related");
                        mp.addBodyPart(bp1);
                        BodyPart bp2=new MimeBodyPart();
                        DataSource source=new FileDataSource("fss.gif");
                        bp2.setDataHandler(new DataHandler(source));
                        bp2.setHeader("discrete-type","image");
                        bp2.setHeader("Content-ID","mickey");
                        mp.addBodyPart(bp2);
                        msg.setContent(mp);
                        Transport.send(msg);
         System.out.println("\nMail was sent successfully.");
    //                    msg.setDataHandler(new DataHandler(     new ByteArrayDataSource(sb.toString(), "text/html")));                                        

  • SQL Query directly sended to HTML Pages

    Hi,
    Sometime, some SQL requests included in tags like
    <ora:SqlQuery dataSource="example">sql request</ora :sqlQuery>
    are directly sended to HMTL page. I have not this problem with Tomcat 3.3, but with Tomcat 4.1 and 5.0.
    In fact, i have a lot of problems to migrate my site from Tomcat 3.3 to Tomcat 4.1.
    Is there any one to have some problems to migrate ?
    Thanks
    MERCIER S.

    hi Cem and thank you for answer,
    I mean that the request is writing in the HTML Page....
    example of the page
    <HTML>
    <HEAD>
    </HEAD>
    select * from example;
    </HMTL>
    The user can see directly the request, not the response
    My site is a quite difficult site with a lots of tags. The structure is a copy of o'reilly JavaServer Pages book. All is rigth with Tomcat 3.3 but with Tomcat 4.1, i have a lot of problems
    MERCIER S.

  • Problem in Opening HTML Page in Internet Explorer from my Swing Application

    Hi,
    I am opening a HTML file in Internet Explorer from my swing application.I am using the code given below
    private final static String WIN_FLAG = "url.dll,FileProtocolHandler";
    private final static String WIN_PATH = "rundll32";
    String cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
    // url is HTML file Path
    Process p = Runtime.getRuntime().exec( cmd );
    Here there are two things i need to address ...
    1)The HTML file is opening up,but it always opens behind the swing application,that makes me every time to maximize the HTML file after it being opened up.I want to open it in front of the Swing Application.I need to implement "Always On Top" functionality for the html page.
    2)Whenever i trigger action to open different HTML page,it opens in new Internet Explorer window.
    I need to open it in same IE window.
    how to solve out these problems ??? any help would be greatly appreciated .Thanks in advance.
    - Manikandan

    any idea about this ????

  • How to send inline HTML page in mail(not as attachment)

    Hi,
    I am using JavaMail to send details to users using text mail. Its working successfully. But now i have to send the details on mails that will contain HTML page (not as attachment but as inline HTML page containing text) and details in it. Plz help me. Its urgent.
    Thanks in advance,
    Devom

    Set the contentType to "text/html" and send away.
    (If you need both text and html you will need to make a multi-part message), this is covered in the FAQ.
    http://java.sun.com/products/javamail/FAQ.html
    travis (at) overwrittenstack.com

  • Problem in refreshing html page using LinkToURL API

    Hi all,
    I use LinkToURL in order to open a html page in a new window. My problem is that this html file is changed (the name is the same but the contents is diff) dynamically. I click on the link and the window is open, but later on when the html file is changed and I reopen the window it shows the old html file. Is it possible to refresh this window automatically every time when it is opened? Otherwise the user has to press Refresh button in order to see the new html file.
    10x for your help.
    Svetlomira

    Hi Svetlomira,
    Do you have access to html file? Can you changed it?
    Or you can use following approach: if html is static (not jsp or asp or similar)
    you can append System.currentTimeMillis() to the html file name after '?' sign:
    final String nonCachedURL = "http://www.domain.com/index.html?" + System.currentTimeMillis();
    You can achieve this by using calculated context attribute and bind it with LinkToUrl`s reference proprty.
    Best regards, Maksim Rashchynski.

  • Problem in displaying html page in JEditorPane....

    Hi All,
    i was trying to display a html page in a JEditorPane. i was able to do that when i'm displaying a html page from a local machine.. But when i try to get the page from some website, it giving me
    "exception access denied (java.net.SocketPermission www.java.sun.com resolve)"
    exception. But if i run the same code thru JBuilder, its working. But thru appletviewer or thru IE or Netscape its throwing the error.. Any suggestion or help is highly appreciated....
    Thanks
    Ragu

    Java Applets are very secure, what is good. Java applets are extremely secure
    what is bad. So Applet cannot open TCP connection to any host rather than its
    home host. So you cannot get the resources from any other server (what is common to
    HTTP).
    In JBuilder iit works cause JBuilder is used for development and security in deevelopment
    is not an issue. But it confuses then you see.
    vpanasenko_even

  • Problem in Printing HTML page

    While I am trying to print a HTML page using window.print(), the bgcolor of the table is not printing.

    Did you consider inquiring about this at a Javascript or HTML forum?

  • Problem with opening html page in Dreamweaver

    Hello,
    I would like to ask the forum because I have a problem with Dreamweaver 8.
    In the past when I work with my PC on Windows XP I didn't have this problem.
    Now I have a new PC with Windows 7 Familial Edition Premium.
    I can open he most pages I would like, .htm particuliarly but some of them like .html don't opened in Dreamweaver 8
    on PC with Windows 7.
    Example:
    With this page: http://www.pb-veille-consulting.com/veille.html
    I can open it with Dreamweaver 8 under Windows XP on my portable PC.
    But I can't open it with Dreamweaver 8 under Windows 7 on my fix PC.
    Where is the problem?
    You could watch the code of this page and perharps give me answers from my question.
    Thanks a lot.
    Patrick.

    It could be that Extensions.txt and MMDocumentTypes.xml do not have the full set file extensions.
    The first one can be located at ~username/AppData/Roaming/Adobe/Dreamweaver CS6/en_us/Configuration and needs to have HTML added to line 1
    The second one can be located at ~username/AppData/Roaming/Adobe/Dreamweaver CS6/en_us/Configuration/DocumentTypes and needs to have HTML added to line 3 so that it looks like
    <documenttype id="HTML" internaltype="HTML" winfileextension="html,htm,shtml,shtm,stm,tpl,lasso,xhtml" macfileextension="html,htm,shtml,shtm,tpl,lasso,xhtml,ssi" file="Default.html" writebyteordermark="false" mimetype="text/html">

  • Problems reading an html page encoded in UTF-8

    I'm trying this code with eclipse:
    public class TestBooking {
          * @param args
         public static void main(String[] args) throws Exception {
              URL url;
              String url_string="http://www.booking.com/searchresults.html?checkin_monthday=21;checkin_year_month=2007-8;checkout_monthday=22;checkout_year_month=2007-8;class_interval=1;offset=0;si=ai%2Cco%2Cci%2Cre;ss_all=0;city=-126693";
              url = new URL(url_string);
              URLConnection connection = url.openConnection();
              HttpURLConnection httpConnection =(httpURLConnection)connection;
              InputStream input=connection.getInputStream();
              BufferedReader prova=new BufferedReader(new InputStreamReader(input));
              String str;
              while ((str=prova.readLine())!=null)
                   System.out.println(str);
    }And I get in the console a strange set of charachers:
    <link rel="alternate" hreflang="el" href="/searchresults.el.html?sid=f190f46ada5404fc896b33035b20d50d;checkin_monthday=21;checkin_year_month=2007-8;checkout_monthday=22;checkout_year_month=2007-8;city=-126693;class_interval=1;offset=0;si=ai%2Cco%2Cci%2Cre" title="������������" />
    instead of the correct:
    <link rel="alternate" hreflang="el" href="/searchresults.el.html?sid=f190f46ada5404fc896b33035b20d50d;checkin_monthday=21;checkin_year_month=2007-8;checkout_monthday=22;checkout_year_month=2007-8;city=-126693;class_interval=1;offset=0;si=ai%2Cco%2Cci%2Cre" title="&#917;&#955;&#955;&#940;&#948;&#945;" />
    How can I fix the problem to read the input correctly?
    Thanks for help.

    No conversion is needed, just specify the encoding when you create your InputStreamReader. But you can't expect text in all those different scripts to display correctly in your console. Even if the console is configured to use an encoding like UTF-8 that can handle all the characters, it won't be using a font with all the appropriate glyphs. But, like you said, it doesn't matter if you can't display all of the page's source code correctly. All you need is to be able to read it, which means using the correct encoding.

  • Problem open new html page from flash

    Hello,
    in IE7 and IE8 block popup lock my external link(page html)
    I use GetUrl(url,"_blank") but not it works
    Why?
    i use flash cs4
    With firefox it work

    thank you for response,
    i have used correct command but not it works.
    It Works, in my popup setting are setting "CUSTOM" not MEDIUM
    thank you

  • Problem sending files from Pages via email

    I am using a Yahoo business mail account. All other emails send just fine using Mail. When I try and send a document out of Pages, it brings up the compose new mail fine and it makes the "whoosh" noise indicating that it's been sent. The recipient doesn't receive it, and it doesn't show up in my "sent items" folder. I tried to send using both wifi and 3G for interest's sake, and neither works.
    I'm not sure what to try to fix this, or if it's a limitation of the SMTP server, or what. Any help would be greatly appreciated - my iPad Pages is gimped without the ability to share documents by email...

    Welcome to Apple Discussions
    iWork documents are packages, a special type of folder. Even though with iWork '09 & iWork for iPad they no longer appear as packages, they still are. On a Mac right-click on the file & look for show package contents. If that option is not there it is a "flat-file" but it can still be unzipped.
    Anyone with Stuffit Expander installed with default settings & who saves Pages files to the Desktop will find folders instead of just the document. This is because Stuffit "sees" the file for what it really is, a package. You can check for yourself by changing the extension from .pages to .zip & unzip the file. You can't e-mail a folder which is why many mail clients balk. Apple Mail will automatically zip a folder, other e-mail clients don't, especially web-based e-mail. I think you may be mailing as a Pages document rather than Word or PDF.

  • Problem in the HTML Page

    Hello All,
    In our SUS system , PO Response tab is visible in Dev system and its not visible in Test System.
    Can you please tell me which settings is missing in Test System and How to find the root cause of the problem.
    Assured Points !!
    Thanks in Advance.

    Hi,
    It may be related to the data, can you check the SRM PO in your test SRM system and make sure PO response is checked in the SRM PO.
    Regards,
    Sreedhar Vetcha

  • I have problems sending a 182 page Lightroom book to blurbs

    Lightrrom never stops, even after having sent more than a GB of data to blurb (wathed in the Mac's activity monitor)

    Boot into Safe Mode and try again.

  • Replace HTML page with an applet

    Hello to everybody!
    I created a servlet who can manage file upload from an HTML page.
    Now I want to replace that HTML page with an applet.
    I know that I need to use multipart/form-data , but I have no experience with applet.
    HTML page code is:
    <html>
    <head><title>Upload</title></head>
    <body>
    <FORM ACTION="http://localhost:8080/examples/servlets/servlet/UploadTest" ENCTYPE="multipart/form-data" METHOD=POST>
    What is your name? <INPUT TYPE=TEXT NAME=submitter> <BR>
    Which file do you want to upload? <INPUT TYPE=FILE NAME=file> <BR>
    <INPUT TYPE=SUBMIT>
    </FORM>
    </body>
    </html>
    Any help for "translating" this html page into an applet?
    Applet will send, like html page, a string and a file.
    Thanks in advance, Liuk

    If you use something like Apache Http Client you dont have to do any low level implementations.
    Also if you are the one who is writing both servlet and applet you dot have to stick to standerd formats. you can develop your own format and write both servlet and applet to handle it. that kind of thing can be done easily even with URLConnection. But if you plan to send large files then URLConnection may not be the right option becouse I have seen many complaining that URLConnection gives OutOfMemoryErrors when uploading large amounts of data.

Maybe you are looking for