How to handle an email message using java mail

I am facing the problem in handling html mails embedded with images. Can anyone give me some idea about handling these contents or can I convert whole mail content to an mht file? If yes, then how to convert that mail content to an mht file.

You have no idea? Then look in your JavaMail download and you will find several sample programs that you can use to get started. It would also help to read the JavaMail FAQ (Google will find it easily for you).

Similar Messages

  • Setting Importance Level for a email message using javax.mail.* API

    Setting Importance Level for a email message using javax.mail.* API
    From what I understand we can set Flag on Email Message. How can we set Importance Leve: High/Low for an email message?
    Thanks
    Purvi

    Most of the message Flags work only for IMAP mailboxes. POP3 supports only the DELETED flag. It must be understood that Javamail is a framework which provides all the features available in a standard mailing system. But whether or not a particular feature works is a functionality of the particular implementation being used.
    Thus for example POP3 cannot differentiate read from unread messages in a mailbox though Javamail provides that feature.

  • Can someone please help me figure out how to "clear" recent email addresses used in Mail?

    Can someone please help me figure out how to “clear” recent email addresses used in Mail?  For example, as I begin typing a name/email address in the “To:” field, Mail begins suggesting addresses that I’ve previously used.  I don’t want any suggestions unless they are in my contacts. 
    Another example:  When using MS Outlook, it will also remember and suggest email accounts previously used, but I can arrow down and delete an account from the list so it won’t automatically popup or suggest in the future. 
    I appreciate any guidance in this matter. 

    The iOS email app stores all email recipients in a list of previous recipients which cannot be turned off. The email address autofill feature when addressing an email pulls from contacts and from the list of previous recipients which can't be prevented. There is no option to clear the list of previous recipients - not at the present time anyway.
    If you don't want any suggestions, select from contacts instead when addressing an email.

  • How to do SAVE AS DRAFT using java mail api

    Hello,
    I want to know how to do SAVE AS DRAFT using Java mail Api.
    thanks

    Hello,
    I want to know how to do SAVE AS DRAFT using Java
    mail Api.
    thanksI don't think you can. That sounds like a feature of a mail client app itself. The Java mail API is for when you're ready to actually send the thing. Saving drafts is storing them somewhere like you would any other data; nothing to do with the mail API.

  • Problem in sending messages using java mail api

    Hi All,
    I have a problem in sending messages via java mail api.
    MimeMessage message = new MimeMessage(session);
    String bodyContent = "ñSunJava";
    message.setText (bodyContent,"utf-8");using the above code its not possible for me to send the attachment. if i am using the below code means special characters like ñ gets removed or changed into some other characters.
    MimeBodyPart messagePart = new MimeBodyPart();
                messagePart.setText(bodyText);
                // Set the email attachment file
                MimeBodyPart attachmentPart = new MimeBodyPart();
                FileDataSource fileDataSource = new FileDataSource("C:/sunjava.txt") {
                    public String getContentType() {
                        return "application/octet-stream";
                attachmentPart.setDataHandler(new DataHandler(fileDataSource));
                attachmentPart.setFileName(filename);
                Multipart multipart = new MimeMultipart();
                multipart.addBodyPart(messagePart);
                multipart.addBodyPart(attachmentPart);
                message.setContent(multipart);
                Transport.send(message);is there any way to send the file attachment with the body message without using MultiPart java class.

    Taken pretty much straight out of the Javamail examples the following works for me (mail read using Thunderbird)        // Define message
            Message message = new MimeMessage(session);
            message.setFrom(new InternetAddress(from));
            // Set the 'to' address
            for (int i = 0; i < to.length; i++)
                message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    // Set the 'cc' address
    for (int i = 0; i < cc.length; i++)
    message.addRecipient(Message.RecipientType.CC, new InternetAddress(cc[i]));
    // Set the 'bcc' address
    for (int i = 0; i < bcc.length; i++)
    message.addRecipient(Message.RecipientType.BCC, new InternetAddress(bcc[i]));
    message.setSubject("JavaMail With Attachment");
    // Create the message part
    BodyPart messageBodyPart = new MimeBodyPart();
    // Fill the message
    messageBodyPart.setText("Here's the file ñSunJava");
    // Create a Multipart
    Multipart multipart = new MimeMultipart();
    // Add part one
    multipart.addBodyPart(messageBodyPart);
    // Part two is attachment
    for (int count = 0; count < 5; count++)
    String filename = "hello" + count + ".txt";
    String fileContent = " ñSunJava - Now is the time for all good men to come to the aid of the party " + count + " \n";
    // Create another body part
    BodyPart attachementBodyPart = new MimeBodyPart();
    // Get the attachment
    DataSource source = new StringDataSource(fileContent, filename);
    // Set the data handler to this attachment
    attachementBodyPart.setDataHandler(new DataHandler(source));
    // Set the filename
    attachementBodyPart.setFileName(filename);
    // Add this part
    multipart.addBodyPart(attachementBodyPart);
    // Put parts in message
    message.setContent(multipart);
    // Send the message
    Transport.send(message);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How do i get email messages back into mail

    hi,
    i recently deleted some email accounts that i no longer use but forgot to save the email messages first. i managed to locate the emails on a backup that i made. i now have lots of .emix files, each of which if i double click them open up so i can read the email, but i cannot find a way of getting them all back into Mail so i can search etc. ideally i want to create a new folder in Mail called Old Mail and get all my .emix files into that folder, but whenever I try and drag and drop them into the folder Mail won't do anything. I don't want to just restore the backup as I have since received emails in Mail from my other accounts, and don't want to lose anything. Any ideas what I need to do?

    Hi
    Use the "Import Mailboxes" function in Mail > File menu and follow the instructions
    Mail Help - enter "Import" has some info as well
    chris

  • How to handle multiple xmls(schemas) using java

    Can anyone give me solution for the below issue.
    We are handling five types of xmls(five different xsds) in our application.We have the XML and its XSD in database. Currently we are using JAXB to create and update the xmls.
    In future there is a chance to add new schema. In that case our current code will not work (because the JAXB is tightly coupled with the xsds) for new schema. Is there any technology or method to handle this situvation?
    I am looking for early respons.
    Thanks
    Dhans

    You have no idea? Then look in your JavaMail download and you will find several sample programs that you can use to get started. It would also help to read the JavaMail FAQ (Google will find it easily for you).

  • How to fetch the BCC address using java mail

    Hi,
    I want to extract the mail address given in the Bcc address field of an email which I fetch it from the IMAP store !!
    I will be very much thankful if this problem is solved !!
    Thanks!!

    You can read the Bcc addresses just like the To and Cc addresses. But.... Note that Bcc addresses
    won't be present in any message you receive; if you could see the Bcc addresses it wouldn't be a
    blind carbon copy. If you create a message with Bcc addresses and save that message in your
    "Sent Items" folder, you'll be able to read the Bcc addresses in that message.

  • How do I delete email messages permanently in mail on Mac OS x 7 in one step

    I am used to MS Outlook where I can press shift-delete and delete them permanently in one step.  On my Mac, I am currently deleting mail which puts it in the trash folder then I have to go through it and delete them again to permanently get rid of them.  There must be some short cut for the Mac that I don't know about. 

    You really don't have to go through the trash folder (unlesss you want to check it) - going to the File menu > Mailbox and choose to erase deleted items in all accounts (or use the key command shown).

  • Consuming messages using Java

    Hi,
    I am using BlazeDS running in Tomcat 6.0.16. The Flex client components are written using Flex 3. I have a messaging destination set up and the Flex producers and consumers are working fine. I am able to push messages from the server top the clients using the MessageBroker.routeMessageToService method.
    How can I read/consume messages using Java in the server? I haven't been able to find any documentation or examples on how to do this. Any help and advice is greatly appreciated ... Thanks!
    -- C

    <div class=Section1><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Alex:<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Thank you for your reply. I would prefer not to use JMS since in<br />order to receive messages asynchronously, I would have to use a J2EE message<br />driven bean.  I am trying to implement a listener that can run in Tomcat. <o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Is there a way of doing this without using JMS? Using the<br />message broker I can get a reference to the destination object. And from there<br />I presume it is a matter of registering a callback handler or such &#8230; but<br />I couldn&#8217;t find anything similar in the javadocs.<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Cheers,<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Chamara<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><br /><br /><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span<br />style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Alex Glosband<br />[mailto:[email protected]] <br><br /><b>Sent:</b> Thursday, March 13, 2008 9:04 AM<br><br /><b>To:</b> [email protected]<br><br /><b>Subject:</b> Re: Consuming messages using Java<o:p></o:p></span></p><br /><br /></div><br /><br /><p class=MsoNormal><o:p> </o:p></p><br /><br /><p class=MsoNormal style='margin-bottom:12.0pt'>A new message was posted by<br />Alex Glosband in <br><br /><br><br /><b>General Discussion</b> --<br><br />  Consuming messages using Java<br><br /><br><br />The easiest way to do this is to use the JMS messaging adapter in BlazeDS. This<br />adapter lets your Flex clients publish messages to and receive messages from<br />JMS destinations. You can also have Java JMS clients that send messages to and<br />receive messages from these same destinations. <br><br /><br><br />Take a look at the &quot;Configuring the JMS adapter&quot; section of BlazeDs<br />dev guide for more information about this. <br><br /><br><br /><a<br />href="http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=messaging_ config_3.html#256378">http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?conte nt=messaging_config_3.html#256378</a><br /><br><br /><br><br />-Alex <o:p></o:p></p><br /><br /><div class=MsoNormal><br /><br /><hr size=2 width=200 style='width:150.0pt' align=left><br /><br /></div><br /><br /><p class=MsoNormal style='margin-bottom:12.0pt'>View/reply at <a<br />href="http://www.adobeforums.com/webx?13@@.59b4a54c/0">Consuming messages using<br />Java</a><br><br />Replies by email are OK.<br><br />Use the <a<br />href="http://www.adobeforums.com/webx?280@@.59b4a54c!folder=.3c061a83">unsubscribe</a>< br />form to cancel your email subscription.<o:p></o:p></p><br /><br /></div>

  • How Do highlight text in the body of an email message in Mac Mail?

    Can anyone tell if IF and HOW I can highlight text in the body of an email message using Mac Mail (in Yosemite).  I do NOT mean MARKUP an attachment.  I want to highlight a word or phrase in the body of my email message.  I know I can change the font color, but can't seem to add a highlight!  Thanks!

    Hi,
    is is possible, - link is below. Works on Yosemite, btw.
    http://www.mihalick.us/how-to-highlight-text-in-yellow-using-apple-mail/

  • How to use java mail to send email to hotmail box

    how to use java mail to send email to hotmail box??
    i can send emails to other box(my company's email account) but for hotmail, the program didnt print any err or exception the recepient cant receive the mail.
    thanks

    you ust to download activation.jar and mail.jar and add them to your build path.
    i have used the googlemail smtp server to send mail the code is following:
    public void SendMail()
    Properties props = new Properties();
    props.put("mail.smtp.user", username);
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.socketFactory.port", port);
    try{
         Authenticator auth = new SMTPAuthenticator(username,password);
    Session session = Session.getInstance(props, auth);
    MimeMessage msg = new MimeMessage(session);
    msg.setText(text);
    msg.setSubject(subject);
    msg.setFrom(new InternetAddress(senderEmail));
    msg.addRecipient(Message.RecipientType.TO, new InternetAddress(receiver));
    Transport.send(msg);
    }catch(Exception ex) {
         System.out.println("Error Sending:");
    System.out.println(ex.getMessage().toString());
    and this the SMTPAuthenticator Class which you will need too.
    class SMTPAuthenticator extends javax.mail.Authenticator {
         private String fUser;
         private String fPassword;
         public SMTPAuthenticator(String user, String password) {
         fUser = user;
         fPassword = password;
         public PasswordAuthentication getPasswordAuthentication() {
         return new PasswordAuthentication(fUser, fPassword);
         }

  • I have an iMac, and have a Verizon DSL account. Recently, my Mac Mail keeps requesting the passwords on my account every few minutes, and will not allow me to send messages using Mac Mail. I cannot edit the outgoing server; how can I send emails?

    I have an iMac, and have a Verizon DSL account (3 email addresses). Recently, my Mac Mail keeps requesting the passwords on my accounts every few minutes, and will not allow me to send messages using Mac Mail (the message says that the outgoing server was rejected. I cannot edit the outgoing server, and the keychain will not save my passwords (the ports are valid). How can I change the outgoing server to send emails, and how can I avoid having Mail request my passwords every 2 minutes? Verizon, as usual, will not provide support to iMacs.

    Is there an email saved in your drafts or outbox folder?  I suspect that Mail is continually trying to send it, and each time Google is rejecting the email message.
    You can open the message and then delete it from your Outbox folder.  Then try removing all @gmail email addresses from it and seeing whether you can send to the other folks.  I suspect that will work.
    With email, if an SMTP server *can* verify email addresses, sometimes it will and it will refuse to send messages.  If a message has to be relayed across servers, no verification is done, and you'll get a bounce if an email address is bad.

  • How to show error message using java.awt?

    How to show error message using java.awt?
    Which is the class corresponding to the JOptionPane?
    Or I need to use Frame ?

    No, JOptionPane is swing!
    You would have to create your own frame, put your message in it, then show it.

  • How to delete message from the fodler of  AOL account using Java mail

    Hello All,
    I am using Java MAil API in my application, i want to delete message from AOL account's folder,
    when i set the folder as "Recently Deleted" or "Trash" , i get an exception as "folder does not exist".
    when i tested , some times mail is moving into Recently Deleted folder, but not every time.
    this is happening in both the interface as AOl Interface or my application.
    when i use folder.close(true) after setting the flag of message as DELETED. it completely remove the message from the acount.
    but i want to let the message be remained in the Recently Deleted folder. what should i do.
    i dont want to remove the message completely from the account.I am using IMAP also.

    You'll need to figure out what the real name of the "Recently Deleted" folder is on the AOL IMAP server
    (assuming it's a real folder and not some sort of "virtual" folder), then copy the message into that folder.
    See the folderlist.java demo program as a way to explore the names of all the folders on the server.

Maybe you are looking for

  • Frequent kernel panics & rebooting

    My PowerBook will run fine for about 15 minutes at a time and then I am presented with a message saying "Your computer needs to be restarted. Please hold the power button down until it turns off, and reboot." I thought this was just going to happen o

  • Font too small

    I downloaded the book Software Engineering for Internet Applications from Ebsco via my local library.  I have a 7 day check-out.  The fonts are WAY too small and clearly don't match what they are supposed to be since the pagination appears to lock th

  • DVD stuck in my mini

    Help. My brand new Install disc for iWork '08 is stuck in in my mini mac. The disc hasn't even appeared on the desktop and I can't figure how to get it out. I've tried holding the mouse or spacebar whilst rebooting. I had this problem with another di

  • Imported photos to ipad they are not looking the same

    i had synced photos to ipad from PC(windows XP) using itunes on PC. After Syncing they are not looking similar they are looking like negatives of original images on PC..

  • Transfer of smart mailbox to a new mac

    hi... how do i transfer my SmartMailbox to a new Mac?