Images not going in email

I am sending an email in HTML format using Java mail.
In this I have included an image using
<img src='c:/clip_image002.jpg'/>
the mail is going fine usng java mail api
If I view this email from my system, I am able to view the image (it seems to be picking the local path). but when I open this email on some other system, email does not display.
Can someone please let me know how to embed the image so that it opens on other system as well.
Here is my code
public static void main(String[] args) {
        String to = "[email protected]";
        String from = "[email protected]";
        String host = "127.0.0.1";
        Properties props = new Properties();
        props.put("mail.smtp.host", host);
        props.put("mail.debug", "true");
        Session session = Session.getInstance(props);
        try {
            Transport bus = session.getTransport("smtp");
            bus.connect();
            Message msg = new MimeMessage(session);
            msg.setFrom(new InternetAddress(from));           
            InternetAddress[] address = {new InternetAddress(to)};
            msg.setRecipients(Message.RecipientType.TO, address);
            msg.setSubject("firmation");
            msg.setSentDate(new Date());
            Multipart mp = new MimeMultipart();
            setHTMLContent(msg, mp);
            msg.saveChanges();
            bus.sendMessage(msg, address);
            bus.close();
        catch (MessagingException mex) {
             mex.printStackTrace();
                while (mex.getNextException() != null) {
                Exception ex = mex.getNextException();
                ex.printStackTrace();
                if (!(ex instanceof MessagingException)) break;
                else mex = (MessagingException)ex;
    public static void setHTMLContent(Message msg, Multipart mp) throws MessagingException {
        String html = "<HTML><head><style><!-- @font-face{font-family:Latha;panose-1:2 11 6 4 2 2 2 2 2 4;mso-font-charset:0;mso-generic-font-family:swiss;--></style></head>";
        html = html + "<BODY><p class=MsoNormal><span style='font-size:10.0pt;font-family:\"Verdana\",\"sans-serif\";mso-fareast-font-family:\"Times New Roman\"'>Dear Mr ABC,</span>";
                html=html+"<img src='c:/clip_image002.jpg'/><br/>";
        html = html + "<br/>Regards<br/>tha<br/><br/></p></font></BODY></HTML>";
        MimeBodyPart p1 = new MimeBodyPart();
        msg.setContent(mp);
        p1.setContent(html, "text/html");
        mp.addBodyPart(p1);
    }

but you never added the image to the multipart. The image is there as a part of the "html" variable and this "html" variable is set as content. Do I need to do something more as well?
public static void setHTMLContent(Message msg, Multipart mp) throws MessagingException {
        MimeBodyPart p1 = new MimeBodyPart();
        DataSource fds = new FileDataSource("C:\\images\\clip_image002.jpg");
        p1.setDataHandler(new DataHandler(fds));
        p1.setHeader("Content-ID","<image>");
        String html = "<HTML><head><style><!-- @font-face{font-family:Latha;panose-1:2 11 6 4 2 2 2 2 2 4;mso-font-charset:0;mso-generic-font-family:swiss;--></style></head>";
        html = html + "<BODY><p class=MsoNormal><span style='font-size:10.0pt;font-family:\"Verdana\",\"sans-serif\";mso-fareast-font-family:\"Times New Roman\"'>Dear Mr ABC,</span>";
                html=html+"<img src=\"cid:image\"><br/>";
        html = html + "<br/>Regards<br/>tha<br/><br/></p></font></BODY></HTML>";
        msg.setContent(mp);
        p1.setContent(html, "text/html");
        mp.addBodyPart(p1);
    }

Similar Messages

  • Why is i tunes gift card not going to email address I sent it to ?

    I tunes gift card not going to email address I sent it to. Why ?

    Sorry, I must have missed your last response, but can you calrify what feature do you want to use in FormsCentral? There are email receipts and email notifications. If you want the user to receive a copy of the date he entered in the form, then the user needs to enter an email address in the form and submit the form, but if you want the user to receive all responses he and others submit to a form, then it's email notification. It sounds like email receipts in your case. For email receipts to work, you need to have an email field in your form and set up Email Receipts in the options tab, by selecting the email field in the "To:" field.

  • Email Notifactions not going to email address

    *** Can I please have an answer to this if possible*****
    I have setup a user to recieve email notifactions and they are not getting them.  I have set them up as a reader and also a co-author and have gotten the message about sharing the form.  The user then clicks on the form name and goes to the site.  When a form is entered the email address is not getting the email.
    Please help I need to get this working!
    Thanks
    Carleen Wood
    NAC Marketing
    631-396-8714
    ==== Response ======
    Hi,
    Please make sure the users you shared the form with have verified their email address with their FormsCentral account. Here is an aritcile on how to set up email notificaitons with others: http://forums.adobe.com/docs/DOC-1424. Please make sure you have everything set up properly.
    One other thing you want to check is to check the spam folder of the emails to receive notifications and make sure FormsCentral emails are not blocked.
    Thanks,
    Wenlan
    ==== Response ======
    Hi Wenlan,
    I used that article to make sure the steps where followed.  When the email comes in the user is clicking on the link and going to the web site. Is there something else that should be done?
    Thanks,
    Carleen

    Sorry, I must have missed your last response, but can you calrify what feature do you want to use in FormsCentral? There are email receipts and email notifications. If you want the user to receive a copy of the date he entered in the form, then the user needs to enter an email address in the form and submit the form, but if you want the user to receive all responses he and others submit to a form, then it's email notification. It sounds like email receipts in your case. For email receipts to work, you need to have an email field in your form and set up Email Receipts in the options tab, by selecting the email field in the "To:" field.

  • Image not going to display

    Hi Friends
    I am creating html report by using TABLE given below. but image is not going to dispaly.how can i do this.
    i have a table with there colmns are
    FATHER_DETAIL(TABLE NAME)
    F_NAME VARCHAR2(50)
    M_NAME VARCHAR2(50)
    L_NAME VARCHAR2(50)
    DOB DATE
    FATHER_IMAGE BLOB
    MIMETYPE VARCHAR2(255)
    FILENAME VARCHAR2(255
    IMAGE_LAST_UPDATE DATE
    Thanks
    Nisha

    Hi,
    I have created a html (plsql anonymous block) report using table given below.My problem is, picture is not coming in Report. i have tried to implement picture by this link code
    http://apex.oracle.com/pls/otn/f?p=31517:64:7932202481965736. sent by mike to me.
    But when i run (<img src="#OWNER#.my_image_display?p_image_id=:P1_A" />) IMAGE code in html region source
    by using identification type(HTML TEXT),its working well
    but when i run IMAGE CODE(<img src="#OWNER#.my_image_display?p_image_id=:P1_A" />) on html region source as identification type(PLSQL ANONYMOUS BLOCK) its only showing the dot,not actually showing the picture in my html report.please suggest me.my table fields are.
    STUDENT_MOTHER_DETAILS(TABLE NAME)
    F_NAME VARCHAR2(50)
    M_NAME VARCHAR2(50)
    L_NAME VARCHAR2(50)
    DOB DATE
    MOTHER_IMAGE BLOB
    MIMETYPE VARCHAR2(255)
    FILENAME VARCHAR2(255
    IMAGE_LAST_UPDATE DATE
    This is my actual report code.
    DECLARE
    AGE INTEGER;
    rec STUDENT_PERSONAL_DETAILS%rowtype;
    begin
    htp.p('
    <html>
    <body><H8> </H8>
    FOR REC IN (SELECT STUDENT_ID,F_NAME,M_NAME,L_NAME,DOB FROM STUDENT_MOTHER_DETAILS WHERE STUDENT_ID =:P1_A)
    LOOP
    SELECT TO_NUMBER(MONTHS_BETWEEN(SYSDATE,REC.DOB)/12) INTO AGE FROM DUAL;
    htp.p('
    <TABLE width="60%" border=1 align="CENTER">
    <TR>
    <td bgcolor=#BFC7E6>Student ID</td>
    <td bgcolor=#D1D7F0>'||REC.STUDENT_ID||'</td>
    <td rowspan="6" colspan="2" bgcolor=#D1D7F0><center>*<img src="#OWNER#.my_image_display?p_image_id=:P1_A" />*</td>
    </tr>
    <tr>
    <td bgcolor=#BFC7E6>Name</td>
    <td bgcolor=#D1D7F0>'||INITCAP(REC.F_NAME)||','||initcap(rec.M_NAME)||','||INITCAP(REC.L_NAME)||'</td>
    </TR>
    <TR>
    <td bgcolor=#BFC7E6>Date Of Birth</td>
    <td bgcolor=#D1D7F0>'||REC.DOB||'</td></tr>
    end loop;
    htp.p('
    </body>
    </html>');
    end;
    Edited by: Nisha Rani on Sep 25, 2009 10:07 PM
    Edited by: Nisha Rani on Sep 25, 2009 11:33 PM

  • Certain image not showing in email

    This issue happened using Firefox 14.0.1 in Windows7
    I have an email that loads several images from a specific website.
    All the images load except the company's logo. At first I thought it might be yahoo mail issue. However I tried opening same email in hotmail, it does not show up as well.
    I've tried all the solutions that firefox provided ( deleting cache, check media blocked, exceptions etc ) and it still not working. I've even re-installed Firefox.
    This problem only appeared on Windows7. I've the same version of Firefox in Mac and it's showing the logo.

    '''Try the Firefox SafeMode''' to see how it works there. <br />
    ''A troubleshooting mode, which disables most Add-ons.'' <br />
    ''(If you're not using it, switch to the Default Theme.)''
    * You can open the Firefox 4.0+ SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
    '''''If it is good in the Firefox SafeMode''''', your problem is probably caused by an extension, and you need to figure out which one. <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes
    ''When you figure out what is causing that, please let us know. It might help other user's who have that problem.''

  • HTML Images not showing in Emails

    Hi,
    Strange things are happening in Mail (Version 2.1.3 (753.1)) on my G5 OS 10.4.11 - images within email are not appearing i.e images of items from companies or newsletter etc only getting '?' marks where images should be.As a side issue I cannot open Safari or do Software Update - all say no Internet connection - I use FireFox mostly 3.03. If I use my MacBook which has Leopard I have non of the above issues - the preferences for Mail are set similar on both Mac's - any suggestions as to what I can do would be appreciated.
    Ian

    Ji Ian, I was hoping a Mail expert would see this, but it doesn't really seem a Mail problem now that I read it!
    Are you saying Firefox works?
    2 things to try...
    Safe Boot , (holding Shift key down at bootup), off the HD & use Disk Utility from there to Repair Permissions, reboot once more.
    Try putting these numbers in Network>TCP/IP>DNS Servers...
    208.67.222.222
    208.67.220.220
    Then Apply. These are safer/faster than most ISP's DNS numbers, and have been patched against DNS poisoning.
    https://www.opendns.com/homenetwork/start/device/apple-osx-tiger

  • Images not appearing in emails

    Randomly today I'm not seeing images in most of my emails.
    Have always had the checkbox for "Display Remote Images" checked.
    They're coming from a wide variety of sources, so doesn't seem to be about the senders.

    Oh geez. Had an app blocking port 80. Changed some settings and all is good in the universe again.

  • Do not disconnect image not going away

    I recently had my 160g ipod classic returned after having the play button fixed. Upon recieving it I encounted the problem that either we could only get the apple image screen or the do not disconnect (with the crossed circle) screen. When plugging it back into the computer the do not disconnect image would remain, yet the computer was trying to acknowledge it.
    How should I go about fixing this?

    I have had that same problem since beginning.
    When it says Do Not Disconnect... DON't!
    To a restart.
    Lock on, of OK+Menu and hold it!
    You may need to try it again.

  • Image not going behind other controls

    I am having difficulties with something that seems like it should be very simple.  I am making a world clocks application.  I have created all of my clock controls, and now I want to put an image behind them (very light, stretches the whole length of the clocks). 
    I have my image uploaded and I added it to the form.  In the layout I stretched it to fit, and did a send to behind.  There it looks how it should, but when I deploy and run it, it is in front of the clocks, not behind.
    I also tried changing the Layer setting (in the properties of the image control) to a negative number, and all of the clocks to a positive value, but everytime I leave the image properties and come back in that field is blank again.
    Can anyone give me any ideas on this?  Thanks in advance!

    Hi,
    Check the code pane whether the z-order in your IMG tag is -1?
    Which SP you are using?
    Regards,
    Sooraj

  • Photos not going from email photo option in camera

    I select a photo from the camera roll (usually the one I just took) select send via email and it will not send - it is never received by the email account - have tried sending it to several different accounts.  Anyone else have this problem?  Before the last update, it worked.
    I can, however, send it by using the 'mms' sending option.  but can't write a note then. 

    turn your iphone off/on, if same issue persists try a reset
    http://support.apple.com/kb/HT1430?viewlocale=en_US
    just to go sure, sending normal mails is possible right?

  • T5120-Alom-Email alert not going through email server.

    Hi,
    I have 3 T5120 and with latest firmware. I have setup ALOM to send Minor email alerts to my email id using a SMTP server we use here. I found that, although the T5120 alom sends(FROM:[email protected]) I don't receive it. I have checked email server logs and found that T5120 alom is using BDAT commad and chunking messages. I don't know much why it does this but as a result email server doesn't deliver email to the recipient.
    I have other Sunfire systems that I get ALOM alerts from fine and they use same email server and recipient email address.
    Has anyone used T5120 ALOM/ILOM to successfully receive an email alert from it? Let me know what can be done to resolve this issue.
    Thanks!

    Have you changed anything with your email recently like to two step validation or your password or???
    in the iPhoto preferences ==> accounts delete your e-mail account and reenter it
    OR
    IMHO the better solution is to set Apple mail as the email client in the iPhoto preferences
    LN

  • E-mail option in knowledge article is not taking to email editor

    Hi Experts,
    We have configured knowledge article, Once we select the knowledge article and clcik on add to cart then we click on on Email it is  not going to Email editor. I have seen one knowledge article tutor where once we click on email after selecting knowledge article it is going to email editor.
    Can any one of you tell me how to achieve this functionality.
    We are manually assigning KAs to categories in categorization schema.
    Thanks & Regards,
    Kumar

    The functionality definitely exists in CRM 7.0. I implemented it myself.
    Check if the smartform CRM_KNOWLEDGE_ARTICLE exist in your system via transaction SMARTFORMS.
    Otherwise ask your developer to help you debug the class method CL_GS_KNOWS_CART_IMPL, EH_ONEMAIL. If your version is same as mine, the attachment is generated at line 36 of the method.
    The email button is not an action, but rather it is an event on the WEBUI and the form is actually hardcoded in the method itself.
    Good luck

  • Emails from the organization are not going through ePrint

    Hi,
    I've been having some issues with the ePrint feature that's configured in one of the printers that we have in our office. The printer is a HP LaserJet 200 color MFP M276nw. Every other client from other email addresses such as Hotmail, Gmail or any other address are able to send emails to our ePrint address and are able to print on it successfully. However, all the emails that are being sent from within our organization are not going through. We get an unsuccesful delivery message from the Exchange server stating that 
    The server has tried to deliver this message, without success, and has stopped trying. Please try sending this message again. If the problem continues, contact your helpdesk
    We had checked with our Exchange administrators and they have advised that the email is trying to be sent, but in the destination it is being rejected. How can I get this issue to be addressed?

    Hello praveen_haridas,
    Welcome to the HP Support forums.  I understand that your corporate emails are failing when trying to send an email to the Laserjet 200 MFP 276nw printer's ePrint email address.
    Are you getting any messages about the failed messages in your ePrintCenter/HP Connected account?  If so what does the message state about the failed job?
    Thank you.  
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • Why are my exported files not going to me email?  I have used 3 different ones.

    Why are my exported files not going to my email (receipts &amp; business card)?  I have used 3 different ones...2 yahoo and 1 hotmail.  I have checked spam box also.

    For the Receipts app I chose to export the info as a PDF file..an email was requested..I entered info and clicked send.  For the Business Card app I chose Send, not Print..an email was requested..I entered info and clicked send.  I haven't received anything, not even in my spam folder.

  • Emails are not going out to everyone, only select people, everyone else gets blocked or bounce backs

    I have a client who uses Business Catalyst and they're having a problem with emails only going out to certain people and not everyone they email. Outside going in, the problem is it either works 100% of the time, or not at all. If it doesn't work the outside people either get a bounced back failed delivery message, or nothing at all and the emails just disappear into cyberspace. And it's not regulated to just one company or one group of domains - it's pretty sparatic on who it's going to work for and who it doesn't work for.
    I checked to see if their IP was blacklisted and the only thing I found was that it just wasn't whitelisted with list.dnswl.org. It wasn't blacklisted with them, it just wasn't listed. Outside of that I cannot figure out why their emails only work with certain people.
    And the problem is across the board with all @grahamwebbacademy.edu email addresses, not just one person's address. Also one reason I'm posting here is that when they put in a support ticket they never get anything back, and my guess is it's because of this very issue, not that no one's responding to them. It's apparently  been going on for a long while too.
    Appreciate the help!
          Wendy

    Hi Wendy,
    Please update the NS records for the domain "grahamwebbacademy.edu".  At the moment I see that it's pointing to our old expired records. This could be the cause of your mail troubles in this case.
    Name Servers:
       NS03.BUSINESSCATALYST.COM     
       NS01.BUSINESSCATALYST.COM     
    Reference: http://whois.domaintools.com/grahamwebbacademy.edu
    Replace any existing name servers with the following name servers:    
    ns1.worldsecuresystems.com
    ns2.worldsecuresystems.com
    ns3.worldsecuresystems.com
    - http://kb.worldsecuresystems.com/kb/change-domain-name-site.html#main_main_Step_2___Point_ the_domain_name_to_our_servers
    Kind regards,
    -Sidney

Maybe you are looking for