Background html images sending an HTML mail

Hello:
I'm sending a mail with html format, and i need the images are embebed in the mail.
I send its like an Attachment, and reference its whith cid:"..." and it works fine while the image isn�t the background, but I need send an html document with an image in background!!!
Somebody can help me? Its Urgent!
Any idea its appreciated. Thanks.

Yes, there is the code:
Properties props = System.getProperties();
//props.put("mail.smtp.host","servidor2000.galia.e-netfinger.com");
props.put("mail.smtp.host",varParametros.varCorreoSaliente);
Session session = Session.getDefaultInstance(props);
Message message = new MimeMessage(session);
InternetAddress from = new InternetAddress(varParametros.varFrom);
InternetAddress to[] = InternetAddress.parse(varParametros.varTo);
message.setFrom(from);
message.setRecipients(Message.RecipientType.TO,to);
message.setSubject(varParametros.varSubject);
Multipart multipart1=new MimeMultipart("alternative");
BodyPart htmlpart=new MimeBodyPart();
htmlpart.setContent(varCorreo,varContentType); //varContentType=text/html
MimeMultipart multipart = new MimeMultipart("related");
multipart.addBodyPart(htmlpart);
for (int i=0;i<varCCorreo.varFicheroAdjunto.size();i++){
BodyPart messageBodyPart = new MimeBodyPart();
     CFicheroAdjunto varCFAdjunto=((CFicheroAdjunto)(varCCorreo.varFicheroAdjunto.elementAt(i)));
     DataSource source=null;
     if (varCFAdjunto.varNombre.toLowerCase().endsWith("jpg") ){
     source=new ByteArrayDataSource(varCFAdjunto.varFile,"image/jpeg");
     }else if (varCFAdjunto.varNombre.toLowerCase().endsWith("gif")){
     source=new ByteArrayDataSource(varCFAdjunto.varFile,"image/gif");
     }else{
     source=new ByteArrayDataSource(varCFAdjunto.varFile,"application/xxx" );
     messageBodyPart.setDisposition(Part.ATTACHMENT);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(((CFicheroAdjunto)(varCCorreo.varFicheroAdjunto.elementAt(i))).varNombre);
messageBodyPart.setHeader("Content-ID","<"+varCFAdjunto.varNombre+">");
multipart.addBodyPart(messageBodyPart);
}//end for
// Put parts in message
MimeBodyPart mbp = new MimeBodyPart();
mbp.setContent(multipart);
multipart1.addBodyPart(mbp);
message.setContent(multipart1);
Transport.send(message);
And in my html code I get:
<body background="cid:name.jpg">
Please, I need help!!

Similar Messages

  • HTML images not visible in Mail

    All of a sudden images are not being displayed in Mail. I've checked the option on displaying html images in mail preferences. How do I get images in mail messages to display?

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, or by corruption of certain system caches. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. Note: If FileVault is enabled on some models, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including sound output and  Wi-Fi on certain iMacs. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • HTML images not showing in Mail

    I've noticed that my images in emails are not loading in 3G or wifi mode. I've checked all settings and rebooted with the same results.
    Anyone else experiencing anything similar? I've checked all the server and general mail settings. Gmail fetch/push address.
    Thanks.

    HI Trayce,
    Open Mac Mail then from the menu bar click Mail / Preferences then select the Viewing tab.
    Select: Display remote images in HTMl messages
    Connect your iPad to your Mac. In the iTunes window under the Info tab, scroll down to: Advanced.
    Select Mail Accounts. Then click the Sync button bottom right side of the iTunes window.
    Restart your iPad. Hopefully images will load on your e-mail.
    Also, on your iPad. Tap Settings / Mail, Contacts, and Calendars. On the right make sure: Load Remote Images is turned on.
    Carolyn

  • How do i insert a background jpeg image in emails (mac mail)?

    anyone know how to do this?
    thanks

    Welcome to the forums, but good golly Edie, why did you post this in the final cut pro forum?

  • How can I set the language when sending an e-mail with attachment - 'Html'?

    "Character Broken"
    I made an ALV program, and this convert to "HTML',  and send an e-mail with this.
    Used Process is:
    DATA: gt_abaplist LIKE TABLE OF abaplist,
          gt_html LIKE TABLE OF w3html,
          doc_chng LIKE sodocchgi1,
          objpack LIKE TABLE OF sopcklsti1 WITH HEADER LINE,
          objhead LIKE TABLE OF solisti1 WITH HEADER LINE,
          mail LIKE TABLE OF solisti1 WITH HEADER LINE,
          reclist LIKE TABLE OF somlreci1 WITH HEADER LINE,
          lv_line TYPE i.
    DELETE FROM MEMORY ID '%_LIST'.
    SUBMIT z_template
       AND RETURN EXPORTING LIST TO MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = gt_abaplist
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
      TABLES
        html       = gt_html
        listobject = gt_abaplist.
    doc_chng-obj_name   = 'URGENT'.
    doc_chng-sensitivty = 'O'.
    doc_chng-obj_descr  = ' '.
    doc_chng-obj_langu  = '3'.
    objhead-line        = ' '.
    APPEND objhead.
    mail[] = gt_html[].
    DESCRIBE TABLE mail LINES lv_line.
    CLEAR: objpack.
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = lv_line.
    objpack-doc_type   = 'htm'.
    objpack-obj_descr  = ' '. 
    objpack-doc_size   = lv_line * 255.
    objpack-obj_langu = '3'.
    APPEND objpack.
    CLEAR: reclist.
    reclist-receiver = 'e-mail address'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng 
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = mail
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        document_type_not_exist    = 3
        operation_no_authorization = 4
        parameter_error            = 5
        x_error                    = 6
        enqueue_error              = 7
        OTHERS                     = 8.
    SUBMIT rsconn01 AND RETURN.
    I want to show  this by "Japanese".
    But the character is broken.
    LIke This:
    u01D1u072C          u0205|            u0205u072C          u0508           QC u04B90m
    How can I set the language?  How can I solve "Charancter Broken" ?
    Plesse, let me know.
    Thank you so much.
    Edited by: Jaime White 999 on Nov 21, 2011 8:45 AM
    Edited by: Jaime White 999 on Nov 21, 2011 8:46 AM

    Hi Jaime,
    Are you saying, you are getting junk characters in the email attachment? Then pls check the following. Since you want to send Japanese fonts, please pass language 'J' in both  objpack-obj_langu = '3' & doc_chng-obj_langu  = '3' instead of '3' please replace it with 'J'.
    Another thing which you may have to check is the SCOT device type. As I understand from my basis colleague, this may also affect your attachment fonts since the emails are sent through SCOT. Go to transaction SCOT-> Settings-> Device types for format conversion. Check whether wrong device type is defined for Japanese there. Hope this helps
    Regards,
    Gokul

  • Sample Java  Code to send an HTML mail with embeded image

    Hello,
    Please can I get a sample Java code on sending an HTML mail with embeded image.
    The HTML message and relevant input parameters withhbe supplied from a PL/SQL that will call the class , the class will embed the image and send the mail to the recepient.

    tev wrote:
    Please can I get a sample Java codeNo. This is a forum, not a code mill.
    Recommended reading: How to ask questions the smart way
    db

  • Cannot view html images from only one sender

    I have the option set to view remote HTML images. I have junk filtering turned off. I have reset my junk mail filters just in case that was the issue.
    There is email from one sender that is a problem. Instead of images I get the blue squares with question marks. I know the images are available because I can view them if I go directly to my Web based email account.
    Additional info - the account is IMAP. It makes no difference if I copy the message to a folder stored on my Mac.

    I figured it out. I had adjusted the height of the input element to a height that did not work well with the padding. Once I removed the height style and adjusted the padding I got the size I wanted and can see the text as it should be.
    Thanks for your help forgottengods!

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

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

  • HTML -- Image (in the background)

    Hi All,
    I want to be able to create an image from an HTML file. I am thinking about writing my own FAX library and need to send G3 images (JAI - JCA). Can anyone point me in the right direction? I do not want to do a screen shot since that would require showing the HTML on the screen. I would like to be able to convert the HTML to a G3 TIFF in the background.
    Thanks in advance,
    --Ed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I am trying to save as a JPEG to begin with... This is my code and I'm having problems. Anyone have any ideas? It is dying on the je.encode(bi) line. Also, for some reason, if I uncomment the commented out lines, it hangs. Any ideas on that one too?
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.FileNotFoundException;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import javax.swing.JEditorPane;
    import com.sun.media.jai.codec.ImageCodec;
    import com.sun.media.jai.codec.ImageEncoder;
    import com.sun.media.jai.codec.JPEGEncodeParam;
    public class HTMLPageToImageConverter
         private HTMLPageToImageConverter() {
         static final JEditorPane p;
         static final Object done;
         static {
             done = new Object();
             p = new JEditorPane();
             p.setSize(1728, 2152);
    /*         p.addPropertyChangeListener("page", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) {
                 synchronized(done) {
                     done.notifyAll();
         static void GenerateHTMLBufferedImage(File htmlFile, BufferedImage img) {
             img = new BufferedImage(1728, 2152, BufferedImage.TYPE_BYTE_GRAY);
             synchronized(done) {
                 try {
                      p.setPage(htmlFile.toURL());
                 } catch(IOException e1) {}
    /*             try {
                     done.wait();
                 } catch(InterruptedException e) { System.out.println("GenerateHTMLBufferedImage InterruptedException"); }
             Graphics g = img.createGraphics();
             g.setColor(Color.white);
             g.fillRect(0, 0, 1728, 2152);
             p.print(g);
         public static boolean SaveHTMLFileToJPEG(String htmlFile, String jpegFile) {
              try {
                   BufferedImage bi = null;
                   GenerateHTMLBufferedImage(new File(htmlFile), bi);
                   FileOutputStream fos = new FileOutputStream(jpegFile);
                   JPEGEncodeParam jp = new JPEGEncodeParam();
                   ImageEncoder je = ImageCodec.createImageEncoder("JPEG", fos, jp);
                   je.encode(bi);
                   fos.close();
              } catch(FileNotFoundException fnfe) { System.out.println("SaveHTMLFileToJPEG FileNotFoundException"); }
                catch(IOException ioe) { System.out.println("SaveHTMLFileToJPEG IOException"); }
              return true;
    }Called from other code
    HTMLPageToImageConverter.SaveHTMLFileToJPEG("d:/page1.html", "d:/page1.jpeg");
    ...Thanks in advence,
    --Ed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Some email images do not show while using the icloud web app.  I can see the images on my IOS devices and in gmail but I only see a small gray box in the icloud web mail app.  Load HTML images is checked in preferences.

    Some email images do not show while using the icloud web app.  I can see the images on my IOS devices and in gmail but I only see a small gray box in the icloud web mail app.  Load HTML images is checked in preferences.  Is there a solution to this issue?

    I've seen the opposite issue.  My wife recieved an email with jpg attachments.  She couldn't see or print them on her iPhone 4S but they showed up fine in iCloud or in the mail app.  I had her forward the email to herself and then they showed up.  I assume there is an issue with how Apple is processing the attachments and resending causes them to get reformatted in a way that makes them easier to handle.
    So yeah.  Seems like some bugs.  Hope Apple fixes them soon.

  • Workflow- sending a html file in a mail(outlook)

    Hi Guys,
      i want to send a html file in a mail(outlook) in workflow. whenever enduser click that file its open automatically sap inbox.
    html file belongs to a logo, if we click on that file it will automatically opens the SAP INBOX.
    this is the my requirement.
    give me suggestion for this requirement or any other solution.
    we appriciate your reply.
    Thanks
    Sankar.
    Message was edited by: sankar surya

    Unless you are prepared to zip and email every folder and
    file related to
    the page,
    exactly as it is on your computer, it would be wiser to
    upload it all to
    your hosting
    server, and send a link to the recipient.
    "2start" <[email protected]> wrote in
    message
    news:erat61$h8m$[email protected]..
    >I need to email a frame page I have created in
    DreamWeaver.. How can I do
    >that?

  • 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

  • Word 2010 Send As Attachment does not send a HTML formatted mail

    Hi!
    I'm using Word 2010 to send a document by clicking File->Save & Send->Send Using E-mail->Send as Attachment.
    In the Outlook 2010  new message window I click the ribbon tab Format Text and then I select HTML as the message format.
    I continue to happily compose the HTML body and send it. On the recipient side (also Outlook 2010) the message body comes in Plain text format even tough the source email in the Sent folder is in HTML format.
    Is this a bug or am I missing something obvious?

    Hi,
    It's not a bug as I can tell, the recipient may have configured Outlook to Read all standard mail in plain text, please let the recipient check the following setting:
    Start Outlook 2010.
    Click the File tab in the Ribbon, and then click Options on the menu.
    Click Trust Center on the Options menu.
    Click the Trust Center Settings tab.
    Click E-mail Security.
    Under Read as Plain Text, check if the check box of Read all standard mail in plain text has been selected, untick it and click
    OK to save the setting.
    Send the email again to test, hopefully the recipient can receive the email as the original format.
    Good luck.
    Regards,
    Melon Chen
    TechNet Community Support

  • Why Mail can´t load html images when it should?

    Hi, This is odd: Mail 6.2 seems unable to load html images on e-mail received even if the preference is set properly. Any clue?

    not at all. It happens since I´ve upgraded to Mountain Lion a few days back

Maybe you are looking for

  • When I tried to update itunes I got the message service apple mobile device failed to start..what can I do?

    When I tried to update my itunes I got a message srvice apple mobile device failed to start and retrying elicits the same message.  What do I do?

  • Looking for a contract actionscript developer

    San Francisco Based Contract Actionscript -  Flex Developer | Streaming Video Solution We are currently seeking a full or part time (at least for the next several months) senior Actionscript & Flex contract developer to help establish our online stre

  • Mount: can't find /dev/sda2/mnt in /etc/fstab

    I'm trying to install Arch on a virtualbox virtual machine to become familiar with it before I install it on my main system. I've created 4 partitions, dev/sda1=1007kB boot partition, dev/sda2/= 4gb root partition which I am trying to mount, dev/sda3

  • Gl_interface help oracle 11.5.5

    I need to get GL data to oracle financials 11.5.5 from an billing system AR the data is the GURFEED table. Can any one help advice how to get that data to the gl_interface table use a adaptor or write a pl/sql program I have not done this. Thanks in

  • Find Cube Mappings from Dictionary View

    How can I find the mappings between the columns in fact table and cube? I'm needing to find the column name in the cube view that a column in the fact table is mapped to. Obviously this is held and it is displayed in the Mappings window in AWM - but