Html file in the content of email.

hi friends,
I want to send email in the html format.
can we pass the html file in the content of mail?
i.e instead of doing this
messageBodyPart.setContent("<html><body> " +
"--------------------------------------------------------------------------------<br><br>"+
""+firstLine+"<br><br></body></html>" );
can I directly pass the html file?
Also if we have images in the html is there any way that instead of hot linking the images we can attach them with mail?

Supplying the html content using a file instead of a String is easy:
messageBodyPart.setDataHandler(new FileDataSource("file.html"));
To include images in the message is harder, see the FAQ.

Similar Messages

  • AppleScript: Add a HTML file in the body of Email by the clipboard

    I would like to insert a HTML file into the body of Email by the clipboard action.
    This is my cord below:
    set the clipboard to (read (choose file) as «class RTF »)
    set theBody to "Hello"
    tell application "Mail"
    activate
      set theMessage to make new outgoing message with properties {content:theBody, visible:true, subject:"mysubject"}
    end tell
    tell application "System Events"
      tell process "Mail"
      set focused of UI element 1 of scroll area 1 of window 1 to true
      keystroke "v" using command down
      end tell
    end tell
    This code enables only rtf file rather than HTML.
    Also I don't want to use the html content by the function of Mail.
    Because if using it, you won't insert both  a html file and body at the same time.
    So what I would like to is to insert a HTML file by the clipboard action into a body.
    Thank you!

    Hi,
    One solution is to use Safari to copy the document:
    set x to choose file -- a HTML file
    tell application "Safari"
        open x
        delay 2
        repeat while source of document 1 does not contain "</html>"
            delay 1.5
        end repeat
        activate
    end tell
    tell application "System Events"
        tell process "Safari"
            set frontmost to true
            keystroke "a" using command down -- select all
            delay 0.3
            keystroke "c" using command down -- copy to clipboard
        end tell
    end tell
    set theBody to "Hello"
    tell application "Mail"
        activate
        set theMessage to make new outgoing message with properties {content:theBody, visible:true, subject:"mysubject"}
    end tell
    tell application "System Events"
        tell process "Mail"
            set focused of UI element 1 of scroll area 1 of window 1 to true
            keystroke "v" using command down
        end tell
    end tell
    Also try this:
    set the clipboard to (read (choose file) as «class HTML») -- a HTML file

  • AppleScript: Change an order of texts and HTML file in the body of Mail

    I would like to know how to insert a HTML file below the Signature in the body of Email.
    This is my code,,,,
    set the clipboard to (read (choose file) as «class RTF »)
    set theBody to "Hello"
    tell application "Mail"
    activate
      set theMessage to make new outgoing message with properties {content:theBody, visible:true, subject:"mysubject"}
    end tell
    tell application "System Events"
      tell process "Mail"
      set focused of UI element 1 of scroll area 1 of window 1 to true
      keystroke "v" using command down
      end tell
    end tell
    What I would like to do is an order of body going like
    From the top:
    Body
    Signature
    HTML rtf file
    Please teach me how to do!
    Cheers,

    Hi,
    murrayshimada wrote:
    Wondering how about inserting a HTML between body and signature? If you have a free time, please give me a tip again. Anyway, thank you for your help. Cheers,
    You can set the order like this:
    set the clipboard to (read (choose file) as «class RTF »)
    set theBody to "Hello" & return & return -- need two return character to paste the clipboard after the body
    tell application "Mail"
        activate
        set theMessage to make new outgoing message with properties {content:theBody, visible:true, subject:"mysubject"}
        my pasteToEnd()
        delay 0.6 -- need a delay to not remove the pasted text.
        set message signature of theMessage to signature 1 -- this put the signature after the text
    end tell
    on pasteToEnd()
        tell application "System Events"
            tell process "Mail"
                set focused of UI element 1 of scroll area 1 of window 1 to true
                key code 125 using command down -- (arrow down + command down) to set the insertion point to the end of text 
                keystroke "v" using command down
            end tell
        end tell
    end pasteToEnd
    Here's another example, the order =  the HTML, the body and the signature:
    set the clipboard to (read (choose file) as «class RTF »)
    set theBody to "Hello"
    tell application "Mail"
        activate
        set theMessage to make new outgoing message with properties {content:"theBody", visible:true, subject:"mysubject"}
        my pasteAtBeginning() -- at beginning
        delay 0.6 -- need a delay to not remove the pasted text.
        set message signature of theMessage to signature 1 -- this put the signature after the text
    end tell
    on pasteAtBeginning()
        tell application "System Events"
            tell process "Mail"
                set focused of UI element 1 of scroll area 1 of window 1 to true -- this set the insertion point at beginning
                keystroke "v" using command down
                keystroke return & return -- to put a blank line between the RTF and the body
            end tell
        end tell
    end pasteAtBeginning

  • How do i send an html file exported from muse as email blast with images and live links?

    My question it:
    How do i send an html file exported from muse as email blast with images and live links?
    I have designed a "website" in adobe muse and exported it as an html file. I am not sure how to send my .html file in an email!
    Best,
    Nicole

    Unfortunately, the answer is, you don't. The requirements for HTML displayed in an e-mail reader are very different than those for HTML displayed in a browser. The output of Muse won't work as an HTML e-mail. You could upload the Muse site as a website and provide a link to it in an e-mail, but the HTML generated by Muse is not suitable for direct display by an e-mail program.

  • I want to put my old bookmarks onto my new computer. I tried the tutorial but it is looking for an html file not the jnos

    ''Duplicate post, continue here - [/questions/768056]''
    I made a backup file. I sent it to myself from another computer as an email. I can download it but can't open it when I chose import bookmarks. It's looking for a html format.

    What format did you back the bookmarks to?
    If it was a JSON file, use the restore process in the [[Backing up and restoring bookmarks]] article. If it was an HTML file follow the procedure in the [[Importing Bookmarks from an HTML File]] article.

  • When I go to my downloads folder on my dock and click the file all the content shows up but as soon as I go to open it in the finder, I get a blank window. Has anyone else had this problem, if so, How do you fix it.

    When I go to my downloads folder on my dock and click the file all the content shows up but as soon as I go to open it in the finder, I get a blank window. Has anyone else had this problem, if so, How do you fix it. I also cant delete anything from this folder because of it. Any help would be greatly appreciated.

    Hey Allen,
    I am having the same issue here in September.  How did yor situation get resolved.  My iPad Siri works great.  My iPhone 5 Siri has been out of comission (OOC) for almost a month and I am beginning to get a little frustrated since Siri works so well in July....ANY assistance would be highly appreciated... Thanx

  • I can't delete a file in the Content-Management

    Hello,
    I can't delete a file in the Content-Management, altough I have full control.
    I get the following error message:
    System error (com.sapportals.wcm.repository.ResourceNotFoundException): null
    Many thanks for the help.

    Dear SAPMuffel ,
    As far as we can see the error "com.sapportals.wcm.repository.ResourceNotFoundException" is telling that the resource you are trying to delete could not be found, that is also to say, it might not exist any more.
    So please let me know exactly how you can reproduc this issue?
    and what kind of file it is? under what kind of KM repository? 
    Is there any other file under the same KM folder?
    Also you can reproduce the issue and then check the lastest defaulttrace file under this folder:
    ../j2ee/cluster/server0/log/defaultTrace.*.trc
    here you can find the detailed exception.
    Best Regards,
    Thunder

  • As of yesterday afternoon, I can no longer view the content of email on my iPhone. When I open the email, there's no content.

    As of yesterday afternoon, I can no longer view the content of email on my iPhone. I can view it on my iPad and my iMac. When I open the email, there's no content. Contact and subject appear, but zero content. It seems to be chronically "checking for email" at the bottom of the screen, whereas the email downloading indicator at the top has finished. This issue is across all three of my email accounts.

    if you're using Yahoo email, this is a common problem with iPhone and Yahoo

  • How to view the file using the content

    Hi all,
    I have uploaded the data from a binary file to an internal table using GUI_UPLOAD.
    Could you please suggest any way how i can view the file using the content.
    The binary content looks as follows.
    345DCC27F35A291DFD5496E0609E8ED08F3405AF5FE3DDC574166CDE0D79B7A174BC6
    D87597FA824B3E56E82E451D4C2B4D32A423279A668BB6690C7E9956E90CFE766CB37
    39E70D650300006D08000011000000776F72642F73657474696E67732E786D6C9C56D
    69B6197B7F5BDD4C58841ECC06943522630781EC71767DF5504F0B6B3C4674DEE0D46
    Thanks,
    Vishnu

    Hi all,
    Thanks a lot for the reply.
    Here, my requirement is to open the content as a file.
    I have used 'GUI_UPLOAD' FM to upload the contents & need the same file(PDF, JPG, DOC etc) to be displayed using the content.
    Eg., If i upload an Image using the FM 'GUI_UPLOAD', based on the contents & extention can i see an image?
    Please help me in the regard,
    Thanks,
    Vishnu

  • Using a URL parameter by the JSP to pull in an html file for dynamic content ??

    I would like to have a simple jsp which could be called from an URL
              with a parameter. I'd like the parameter to be used by the JSP to form
              a filename of a second file. This second will be a chunk of HTML
              which is sucked in to the JSP to form some content in a particular
              HTML table cell.
              The ASP is this :
              <%
              targetPath = Server.MapPath(Request.QueryString("Content")+".txt")
              // makes a variable called targetpath which is a filename called
              something.txt
              Dim filesys, myloadedfile, line
              Set filesys = CreateObject("Scripting.FileSystemObject")
              Set myloadedfile = _
                   filesys.OpenTextFile(targetPath,1,0)
              Do
              // loops round each line of the something.txt file putting them in the
              JSP
                   line = myloadedfile.Readline
              %>
              <%=line%>
              <%
              Loop Until myloadedfile.AtEndOfStream
              myloadedfile.Close
              %>
              Please can someone help me out with some info on the JSP equivalent
              please?
              Thanks Heaps
              Rob
              

              See Content tag on http://www.servletsuite.com/jsp.htm
              This custom tag lets to add any file (even the outisde
              of your web application).
              [email protected] (rob) wrote:
              >I would like to have a simple jsp which could be called from an URL
              >with a parameter. I'd like the parameter to be used by the JSP to form
              > a filename of a second file. This second will be a chunk of HTML
              >which is sucked in to the JSP to form some content in a particular
              >HTML table cell.
              >
              >The ASP is this :
              >
              ><%
              >targetPath = Server.MapPath(Request.QueryString("Content")+".txt")
              >// makes a variable called targetpath which is a filename called
              >something.txt
              >
              >Dim filesys, myloadedfile, line
              >Set filesys = CreateObject("Scripting.FileSystemObject")
              >Set myloadedfile = _
              >     filesys.OpenTextFile(targetPath,1,0)
              >Do
              >// loops round each line of the something.txt file putting them in the
              >JSP
              >     line = myloadedfile.Readline
              >%>
              ><%=line%>
              ><%
              >Loop Until myloadedfile.AtEndOfStream
              >myloadedfile.Close
              >%>
              >
              >Please can someone help me out with some info on the JSP equivalent
              >please?
              >
              >Thanks Heaps
              >
              >Rob
              

  • How to I add options to the Context Menu for html files under Site Content

    Currently in Web Page Composer...  if a developer wants to get the Target URL to an html page in a WPC site (i.e. under the Site Content folder) they have to take several steps...   Content Menu -> Details -> Settings -> Properties -> Access Links -> copy the Target URL.  I would like to add this ability (i.e. to copy the target URL to clipboard) as a option to the "context menu" of each html file.  Does anyone know if this is possible and if so how it can be done?   It can be a global change if necessary.

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    Also check the Mouse driver settings in the Control Panel.

  • Firefox will not display my HTML file as its contents - only displays the HTML text (firefox 5.0).

    I can download a file as a Firefox file (zipped) and it displays successfully. Then I can save the file as a text file and see the HTML text.
    When I work on the HTML text file and then try to display the modified file in Firefox 5.0 and Windows XP, Firefox will only show the HTML text, not the display of the contents of the file.

    Make sure that the file has a .html file extension if you want Firefox to render the content.
    Your above posted system details show outdated plugin(s) with known security and stability risks.
    *Shockwave Flash 10.0 r32
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/

  • In Web Logic Server Due to HTML file tag the action of struts is not called

    Hi All
    I have a problem as under:-
    There is a HTML page which contains several fields including a file input tag of HTML and i write enctype = "multipart/form-data" in the form tag
    I am calling a struts Action from this form, then it is not reaching to that action of struts.
    If I remove this file tag and enctype = "multipart/form-data" then it reaches to the struts action.
    I am facing this problem in Weblogic server 8.1 but i can easily deploy this same code on Tomcat 5.0
    Please help me out from this problem..
    Thanks...
    Nitin Saxena

    My installation has a DefaultWebApp directory under mydomain/applications,
              try moving everything down there. (I'm on 6.1 but I think 6.0 is the same)
              Eliot Stock
              eliot [ at ] carbonfive [ dot ] com
              http://carbonfive.com
              "Ram" <[email protected]> wrote in message
              news:3bc71641$[email protected]..
              >
              > Hi,
              >
              > I am trying to deploy a simple servlet in WebLogic Server.
              > I have done the following steps.
              >
              > 1) Compiled the MyWorld.Java Servlet Successfully in c:test\ Directory..
              >
              > 2) Created WEB-INF/Classes Directory in the home Directory of
              WebApplication Directory..
              > C:\bea\wlserver6.0\config\mydomain\applications\
              > 3) Copied the Class file into the WebApplication Directory i.e
              >
              > C:\bea\wlserver6.0\config\mydomain\applications\WEB-INF/Classes
              >
              > 4) Executed in the Browser using following URL:
              > http://127.0.0.1:7001/MyWorld
              >
              > But, I am getting this error:
              >
              > Error 404--Not Found
              >
              > Please let me know if the above procedure is wrong, then what are the
              exact steps
              > involved in Deploying a servlet in WebLogic Server.
              >
              > Thanks,
              > Ram.
              >
              

  • Need help displaying HTML files stored in content repository

    I have a very simple HTML file stored in a binary attribute (so the file could
    be uploaded through the Admin Portal) named "html" in the BEA Repository (8.1sp2)
    and would like to display it in a JSP. Here's a snippet from that JSP:
    <cm:getNode path="<%=myNodePath%>" id="myNode"/>
    <cm:getProperty node="<%=myNode%>" name="html" conversionType="html"/>
    I expected the getProperty tag to fetch the HTML file and render it inline, but
    I guess that's wishful thinking. Am I missing something?
    Thanks for any help!

    I added transactionTimeout="30" to the tag shown below. That did the trick, as
    long as I avoided certain combinations of tag attributes. Guess this one's a little
    moody.
    Thanks, Greg.
    Gregory Smith <[email protected]> wrote:
    Try setting the transactionTimeout to something greater than 0 on the
    <cm:getProperty> tag.
    Greg
    Marc N wrote:
    I have a very simple HTML file stored in a binary attribute (so thefile could
    be uploaded through the Admin Portal) named "html" in the BEA Repository(8.1sp2)
    and would like to display it in a JSP. Here's a snippet from that JSP:
    <cm:getNode path="<%=myNodePath%>" id="myNode"/>
    <cm:getProperty node="<%=myNode%>" name="html" conversionType="html"/>
    I expected the getProperty tag to fetch the HTML file and render itinline, but
    I guess that's wishful thinking. Am I missing something?
    Thanks for any help!

  • Abstract Portal Component: How to inclue a HTML file into the response?

    Hi experts,
    i am currently working on the problem, that i want to access KM inside my AbstractPortalComponent in order to retrieve a HTML File.Afterwars i want to include this file into my IPortalComponentResponse.
    IPortalComponentResponse offers the method include(IPortalComponentResponse , IResource)
    Is it possible to use this method to achieve my goal?
    I have tried this approach:
    IResourceContext resourceContext = new ResourceContext(requester);
    RID rid = RID.getRID("/documents/test.gif");
    IResource resource = ResourceFactory.getInstance().getResource(rid,resourceContext);
    response.include(request,resource);
    But the problem is that this IResource doesn't match the IResource that is needed for this method.
    My IResource belongs to com.sapportals.wcm.repository.IResource
    But the Methos just works with com.sapportals.portal.prt.resource.IResource
    So can you help me on this one?:)
    With Best Regards
    Marcus

    Hi,
    read the contents of the resource and put them to the output.
    Dumb but working piece of code:
    private String renderResource(IResource resource, boolean html) {
              StringBuffer buf = new StringBuffer("");
              try {
                   IContent content = resource.getUnfilteredContent();
                   if (content != null) {
                        InputStream is = content.getInputStream();
                        byte[] bytes = new byte[(int) content.getContentLength()];
                        int i = is.read();
                        int count = 0;
                        while (i != -1) {
                             char b = (char) i;
                             bytes[count] = (byte) i;
                             count++;
                             i = is.read();
                        buf.append(new String(bytes, "UTF-8"));
                        if (html) {
                             buf.append("</br>");
                        } else {
                             buf.append('\n');
              } catch (Exception e) {
    // do something
              return buf.toString();
    hope this helps,
    Rmano

Maybe you are looking for