Problems setting email headers with javax.mail.*

I'm trying desperatly to send HTML emails with javax.mail but I simply can't. No matter what I do, no matter how and where I set the headers it always come out as text.
Here's a sample code:
try {
          Properties props = System.getProperties();
          props.put("mail.smtp.host", "smtp.ability.com.br");
          Session session = Session.getDefaultInstance(props, null);
          Message msg = new MimeMessage(session);
          msg.setHeader("Content-Type", "text/html");
          msg.setRecipient( MimeMessage.RecipientType.TO, new InternetAddress("[email protected]") );
          msg.setFrom( new InternetAddress("[email protected]") );
          msg.setSubject("teste");
          msg.setText("<b>testeeeeeeeeeeeee</b>");
          Transport.send( msg );
          } catch( Throwable t ) {
               System.err.println(t);
          }and here's the resulting email:
Return-Path: <[email protected]>
Delivered-To: [email protected]
Received: (qmail 5895 invoked by uid 510); 21 Dec 2004 16:41:49 -0000
Received: from [email protected] by relay03.dominal.com
Received: from unknown (HELO christian) (200.217.110.124)
  by 0 with SMTP; 21 Dec 2004 16:41:48 -0000
Message-ID: <20590970.1103647309922.JavaMail.christian@christian>
From: [email protected]
To: [email protected]
Subject: teste
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
<b>testeeeeeeeeeeeee</b>What am I missing here?
Thanks in advance,
Christian

msg.setText("<b>testeeeeeeeeeeeee</b>");R
eplace that
bymsg.setContent("<b>testeeeeeeeeeeeee</b>",
"text/html");
Thanks DrClap, but that's not exactly the solution I'm looking for, cuz I would have to hard-code that header.
I have an Email class that I use as a wrapper for the javax.mail API, and I wanna be able to have a setHeader() method that works to enable the users to set the content-type of the text (or HTML) portion of the email, even when there are attachments. How can I achieve this?

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.

  • Problem setting up WDS with MSI RG54GS2 & Motorola WR850g

    Problem setting up WDS with WR850g & MSI RG54GS2
    Hi,
    I'm trying to bridge 2 routers: Motorola WR850g & MSI RG54GS2 .
    I set the MSI as the main router (it works better for me as a router than the Moto), and the Moto is the repeater. I have set it up exactly as the guide on Broadbandreports.com for the Motorola , and on Tom's Networking http://www.tomsnetworking.com/2004/04/14/how_to_wds_bridge/
    The Moto sees the MAC of the MSI (Status is UP), the MSI doesn't have a page that shows WDS MACs . I know the routers are connected because when I connect a laptop to the Moto wireless network, it gets an IP (and the DHCP on the Moto is disabled) and the default gateway of the connection is the IP of the main (MSI) router.
    The problem is I can't surf anywhere. I can't even ping the MSI router - which should be possible if the WDS works properly.The Moto Wireless Bridge Operation is set properly to Access Point/Wireless Bridge .
    Can anyone solve this?
    Thanks.

    David, welcome to the discussions.
    Are you refering to Airport Extreme Setup as the Extreme base.
    Or are you using a 3rd party Router as your primary Base, or the Express as the primary base.
    Read the supplied link, Not all 3rd party routers are WDS compatible.
    http://discussions.apple.com/thread.jspa?messageID=2785566
    Who is you Internet Service Provider?
    What brand and Model Modem did they furnish?
    Are you using Dial-Up...DSL...or Cable?
    http://docs.info.apple.com/article.html?artnum=303595
    See if there is any help from this link.
    http://discussions.apple.com/thread.jspa?messageID=607414
    Cheers Don

  • Problem setting up ATT email account with Apple Mail

    I have a main ([email protected]) and sub email account ([email protected]) with ATT/Yahoo (formerly SBC).
    I set these accounts up on Apple Mail for the first time, and selected the option "Remove copy from server after retrieving a message "RIGHT AWAY". But Apple Mail would not allow me to select that option for both the primary and sub account. It allowed me to select that option for the first account I set up (the sub account), but when I tried to select that option for the second account (the main account), it would not permit me to save the option and gave me the following error message:
    The account path /Users/edelbert/Library/Mail/[email protected]@pop.att.yahoo.com is already being used by the account "GIFilm"
    It will allow me to select the option to remove the copy AFTER ONE WEEK, but then I receive the same message over and over each time Apple Mail checks the ATT server.
    ATT claims that it is the result of an SSL conflict between its software and Apple's, and claims that Apple has created a bug fix, but I can find no evidence of such a patch.
    Can anyone help me?
    Thanks

    As far as I can tell, the problem might be with my password. It's working on my iPhone, but not my computer.
    If it's just a matter of changing the password, it's cool. But I can't figure out how to change the password.
    Any ideas on changing the password in mail preferences?
    Thanks,
    mhh

  • Have problem setting Email alerts for Calendar events. Warning message says I need to set up a card in Contacts with my email. I do but it doesn't recognize it. How do I indicate the email I want alerts sent to?

    The system of setting up email alerts for Calendar events worked fine in Snow Leopard but since I upgraded to Mt. Lion Calendar won't let me set email alerts. When I try, I get an error message saying I need to set up a card in Contacts for my email. I have a card set up in Contacts for both of my email addresses but it doesn't recognize them. Perhaps the name I have on the card doesn't match a name that Calendar is looking for. Calendar doesn't seem to have a way in Preferences or elsewhere to indicate the email I want alerts sent to. Any ideas how I can get this system working again? Thanks for your help.

    You might want to consider starting a new discussion. Since this one is marked solved, less people are likely to look at it. You can link to this one.
    See if another contact is marked as this is my card.

  • Problems replacing email-subject with SAPConnect

    Hi there,
    I'm sending an order confirmation via SAPConnect as email.
    The order confirmation attaches the email as a *.PDF file.
    Now i'd like to replace the standard subject, that consists in the spool-number and some text from  the message i use.
    So, i went to SPRO, and put 'Your Order: &VBAK-VBELN&' in the mai title. That worked almost properly, because the spool number stayed.
    So, i don't want this spool number output any longer.
    The second point is, that i've tried to replace the standard output of the mail text. I didn't succeed at all.
    So, my question. do you have any ideas to solve my problems?
    Thanks for reply, greetings and happy eastern
    Stefan

    msg.setText("<b>testeeeeeeeeeeeee</b>");R
    eplace that
    bymsg.setContent("<b>testeeeeeeeeeeeee</b>",
    "text/html");
    Thanks DrClap, but that's not exactly the solution I'm looking for, cuz I would have to hard-code that header.
    I have an Email class that I use as a wrapper for the javax.mail API, and I wanna be able to have a setHeader() method that works to enable the users to set the content-type of the text (or HTML) portion of the email, even when there are attachments. How can I achieve this?

  • Problems setting up a Domain - javax.management.InstanceNotFoundException

    I am having problems setting up a Domain. The following steps summarize
    what I have done.
    1. Created FooDomain in d:/bea/wlserver6.0/config and created
    appropriate config.xml, startup scripts, security, etc... (FooDomain
    boots ok)
    2. Moved console.war to bea/wlserver6.0/config/FooDomain/applications
    3. Connected to FooDomain via console (works ok).
    4. Defined machine FooMachine (happens to be localhost)
    5. Defined new server FooServer (in addition to default myserver) and
    assigned it to FooMachine.
    6. Created a new directory d:/managedServers/FooServer (note - outside
    installation directory)
    7. Created directories d:/managedServers/FooServer/logs &
    d:/managedServers/FooServer/applications
    8. Copied sample startManagedServer.cmd from mydomain to
    d:/managedServers/FooServer & modified appropriately.
    9. Ran startManagedServer.cmd (Note: I was able to connect to the
    Administration Server ok)
    The problems are as follows. (From the console - pointing to the
    Administration Server for the FooDomain)
    1. I am unable to configure a DefaultWebApp_FooServer to be located at
    d:/managedServers/FooServer/applications. I get the following exeption:
    javax.management.InstanceNotFoundException:
    FooDomain:Name=DefaultWebApp_FooServer,Type=WebAppComponent.
    2. I get a similar error when trying to set FooServer log locations to
    d:/managedServers/FooServer/logs
    Any ideas as to why? This then begs the question, what if FooServer was
    on a different physical server altogether. How would I define the
    location of the DefaultWebApp and logs.
    Thanks
    jay ()

    If you want your application work, think my way. At least, all my teammates have used this method to build their development environment. If you are more interested to debug for Weblogic, contact your support representative. The tools from Administration console look very nice, but not function as you want (e.g., the tool to convert version 5.1 application to version 6, even monitor tools). Administration console is very nice to be used to configue the parameters for a domain, but not so trustful and not for application setup in my own experience and that is why I suggest you use mydomain and DefaultWebApp_MyServer as templates. By the way, I did modify config.xml manually to change the default web application entry, etc, to what I want.
    Jay Zammit <[email protected]> wrote:
    I did not modify config.xml manually. In fact, I am able to boot both the Administration Server & Managed Server. The problem happens when using the Administration console to assign my logs and Default Applications directory to the d:/managedServers/FooServer/logs, and d:/managedServers/FooServer/applications/DefaultWebApp_FooServer directories. Try it yourself. Go to the Configurer WebApp option and type in a fully qualified directory such as d:/managedServers/FooServer/applications/DefaultWebApp_FooServer
    and see if it works on your system.
    thanks
    jay ()
    Xiang Rao wrote:
    One suggestion. Use the default domain mydomain as a template. Just make a copy of "mydomain" in folder config and rename the copy to whatever you like. Use some help tools to search all files (non-binary files) in new domain for key word "mydomain" and replace these words with your new domain name. To build an application, just rename the DefaultWebApp_MyServer to what you like and search "DefaultWebApp_MyServer" in all files (non-binary files) in your new domain and replace these words with yournew application name. Note you need to modify the scripts accordingly. Then you can run "startWeblogic" in your new domain directory to start your new domain. Other parameters should be configured by Administration console. If you manually modify configuration files, you could expect some bad news without reason.
    Jay Zammit <[email protected]> wrote:
    I am having problems setting up a Domain. The following steps summarize
    what I have done.
    1. Created FooDomain in d:/bea/wlserver6.0/config and created
    appropriate config.xml, startup scripts, security, etc... (FooDomain
    boots ok)
    2. Moved console.war to bea/wlserver6.0/config/FooDomain/applications
    3. Connected to FooDomain via console (works ok).
    4. Defined machine FooMachine (happens to be localhost)
    5. Defined new server FooServer (in addition to default myserver) and
    assigned it to FooMachine.
    6. Created a new directory d:/managedServers/FooServer (note - outside
    installation directory)
    7. Created directories d:/managedServers/FooServer/logs &
    d:/managedServers/FooServer/applications
    8. Copied sample startManagedServer.cmd from mydomain to
    d:/managedServers/FooServer & modified appropriately.
    9. Ran startManagedServer.cmd (Note: I was able to connect to the
    Administration Server ok)
    The problems are as follows. (From the console - pointing to the
    Administration Server for the FooDomain)
    1. I am unable to configure a DefaultWebApp_FooServer to be located at
    d:/managedServers/FooServer/applications. I get the following exeption:
    javax.management.InstanceNotFoundException:
    FooDomain:Name=DefaultWebApp_FooServer,Type=WebAppComponent.
    2. I get a similar error when trying to set FooServer log locations to
    d:/managedServers/FooServer/logs
    Any ideas as to why? This then begs the question, what if FooServer was
    on a different physical server altogether. How would I define the
    location of the DefaultWebApp and logs.
    Thanks
    jay ()

  • Has anyone found the solution to email disappearing with Apple Mail?

    Hello,
    I have seen quite a number of postings about email disappearing with Apple's Mail client, regardless of what account they are using (yahoo, gmail, aol, etc.). What I have noticed is that email vanishes right in front of my eyes from the folders I have created to keep my email in order. Sometimes I move a message or several and I see them in the folder for a day or two, and then a few days later they are simply gone. This happens from the sent folder too. It is random. No, they are not in the trash, or junk, or anywhere else. Doing a full search turns nothing. They are really, really gone.
    Sometimes, I go to a folder and I see how in a second one or several messages disappear from the list and that is it. Never to be found again. Not even if I visit the web-based account I can retrieve them. They are gone.
    The worst part is when they disappear from my sent folder immediately after they leave the outbox, so I am not sure if it sent or not, and I have to retype the whole thing again just to make sure.
    This is extremely annoying, and I have seen I am not the only one to which this happens. Has anyone found a fix for this bug? Should I simply keep all my email in my inbox? Or should I just give up on Apple Mail and use Thunderbird?
    I have an old powerbook G4 with 10.4 and Mail 2. Not like it makes much difference, I've seen people complaining about the same issue in later versions of OS and Mail.
    Thanks for any help
    Annie

    Let's see if we can dind how many Mail files on your computer.
    http://validator.w3.org/
    I'd get EasyFind...
    http://www.macupdate.com/info.php/id/11076
    Here's a direct download link to EasyFind 4.0 which runs in 10.3.9 & up...
    http://www.devon-technologies.com/files/legacy/macosx1039/EasyFind.dmg.zip
    From this page,
    http://www.devon-technologies.com/support/faqs.php?p=default&cat=19
    Freeware applications:
        * EasyFind 4.0
        * PhotoStickies 5.6
        * ThumbsUp 4.3
        * XMenu 1.8
    http://www.versiontracker.com/dyn/moreinfo/macosx/8707
    Use it to search your whole drive for case insensitive & show invisibles...
    .emlx
    (dot ee em el ex)
    Find Any File...
    http://apps.tempel.org/FindAnyFile/
    Hold Option/alt when clicking on Find button to Find All.

  • Problems setting up WNA with OAS 10.1.2.0.2 and Windows 2008

    Hi,
    I am trying to set up WNA with an OAS 10.1.2.0.2 in a RHEL 4 platform. I have been able to configure Synchronization and Windows External Authentication following these steps:
    http://download.oracle.com/docs/cd/B14099_19/idmanage.1012/b14085/odip_actdir003.htm#i1010999
    I have also tried to configure WNA without success with those steps.
    The scenario is here:
    * OAS 10.1.2.0.2 infra in a RHEL 4
    * Windows 2008 SP1 (only i use AD from it)
    * Windows XP (client) that should be able to log in without problems when WNA is configured
    How can make it work? I haven´t find any useful documentation
    Thanks,
    Max

    Check these out:
    http://www.freeoraclehelp.com/2011/09/oid-integration-with-ms-active.html
    http://www.freeoraclehelp.com/2011/09/enable-ssl-for-oid-instance-of-oracle.html
    http://www.freeoraclehelp.com/2011/09/oracle-password-filter-to-sync.html

  • Email tracking with Mac Mail?

    Is there an email tracking service that would seamlessly integrate with mac mail?
    I have used mailchimp.com for one of my email marketing campaign, and I was wondering if a service like that could be integrated into mac mail with a plugin or something.
    Thank You!

    Sometimes getting an email with an attachment is a pain.
    It isn't mac mail it is the email server you are connecting to.
    There is a whole host of reasons why it can be slow.
    Don't worry about it unless this freind sends you more attachments and you continue to have trouble then you need to contact the dns administrator of the mail server and report a complaint.

  • Problems importing email from Snow Leopard Mail into Lion Mail

    I've recently moved from a MacBook Pro 1,1 running Snow Leopard to a new MacBook Pro running Lion.  I had the folks at the Apple Store do the set up - they migrated everything from my old to my new.
    Everything is where it should be and most everything works, except Mail. 
    I have about 90 GB (yes, I know) of stuff in the Mail folder and every time I try to import the old emails into Lion Mail the process stalls out.  And when I try to restart I have twice as many emails and I lose 10+ GB of hard drive space. I've gone from having 110GB available to 50 GB in two days and I still don't have access to my old emails.
    I've deleted the envelope files, the smart mailbox files, deleted old attachment files and other cruft still floating around the Mail folder but my last attempt at importing stalled out and quit after getting halfway through.
    Any suggestions or ideas?  Help!

    Thanks.... I actually managed to find nearly 70 GB of attachements and trashed emails which apparently Apple Mail still keeps in the Mail folder.  I'm trimming now and I'll try another import this evening. In related news, my system is working much much faster now. 

  • Encoding problems in email while on Windows Mail app

    Hello.
    I have a question concerning email and encoding problems in the Windows Mail App in Windows 8.1.  I have encountered a problem with an email I received, while reading, I see strange ASCII characters in one email.  I have never encountered it in
    my web browsers nor Gmail, just the Mail App.
    I was referred to come here when I had asked a similar question there:
    http://answers.microsoft.com/en-us/windows/forum/windows8_1-ecoms/strange-foreign-ascii-characters-appearing-in/911f8a44-c302-4fa1-bcaa-3297b32d9120
    I don't know which forum to go to so I picked here.
    Is there any way that it can be resolved.  I tried to troubleshoot, nothing worked; I even synched, to no avail.
    I look forward to a response.
    JB

    Hi JB,
    The responder on answers was a bit confused. The MSDN forums are for developers to discuss writing their own apps. We cannot help with problems using Windows or its built-in apps.
    If the folks on answers cannot help then you may need to open a support incident. See
    http://support.microsoft.com , or the folks on answers may be able to direct you to the specific page for the Windows Mail app.
    --Rob

  • I am having problems setting up iCloud with Outlook 2007.

    I was able to setup the email with Outlook, but every time I try to setup the contacts.  I get the following error:
    your setup could not be started because of unexpected error
    This error does not occur immediately, but occurs after several steps of downloading and uploading. 
    If I hit the report button, it hangs. So I hit cancel after that in my retries.  I am on Windows 2007 (32-bit). 

    You need to leave more information like what is the ios5 device. I following instructions accidently set up two iclouds and then I couldn't get the contacts in. My mobileme email isn't going to work anymore because I set up an icloud using my store apple ID. Apparently the term apple ID can refer to any apple product ID that you make up not the one you use in the store. So you need to leave more infor on what is your problem to figure out how to help.
    GR

  • Using a personal email address with Yahoo Mail

    I have a premium Yahoo Mail account which allows me to receive mail from an external account (one with an address that does not end in yahoo.com) and send mail as that account as well (so my recipients never see a yahoo.com email address or otherwise know I use yahoo mail).
    When I set up the account on my iPhone, I can browse and read my mail fine, but I can't figure out how to send mail using my preferred address. All my outgoing mail from the iPhone has the yahoo.com address. I can't find a place to put my preferred address - if I put it into the address field, then the Mail client can no longer sign in to Yahoo Mail because this is also my account name with Yahoo.
    What I need is a place to indicate an email address for new messages which is different than the account name, but I can't find it.
    Is this possible to do? How should I set it up?
    Thanks,
    Frank

    It is not possible.

  • Problems setting up WDS with AE

    I recently had some problems with my home network and performed a hard reset on both of my AE base stations in order to reconfigure the network. I am trying to set up a WDS network with the two AE's (one being connected to the internet and the other serving as a remote to extend the range and use AirTunes function). When using Airport Utility and going through the setup process, I set up the primary AE with the connection to the internet. I am then using Airport Utility to try and configure the second AE to join the main network, but AU is not allowing the remote AE to connect/join the primary network. I keep getting an error message saying that the Apple wireless device could not join the WDS network and that I should close Airport Utility and try again. I have tried this a number of times, as well as performing more hard resets of both AE's and nothing seems to be working - any suggestions??
    This is the first time I have ever had this problem using AU. In past versions of the program this has always worked setting up the network automatically, but does not seem to be working this time. Any suggestions would be helpful.
    Thanks,
    JB

    You would get better responses if you posted in the airport section of the forum.
    http://discussions.apple.com/category.jspa?categoryID=140

Maybe you are looking for

  • How do I make sure my mic is working?

    I purchased a USB port Logitech mouse a few months ago and a relative accidently through away the box with the directions. How do I record vocals on the computer and how do i make sure the mic works?

  • Help! Why do my Classic applications refuse to run?

    I don't know if this is the best forum for this problem but hopefully someone here will either be able to help me or tell me where I can look for help. I have been using Classic mode with my G5 to run Microsoft FrontPage, which I use for my website.

  • Need Information on SMD tool

    Hello SAP Guru's,                            Need information about Share Master Data(SMD) tool.                            1) What is SMD tool?                            2) What for SMD toll used?                            3) How to use SMD tool,

  • Where is the source code of custom UI page written

    hi experts, I am currently working on CRM 6.0 we have the standard UI page in SAP ,on which we  have added our enhancements.Now I need to know where is the html code for the standard page is written,since I need to add a meta tag in that code.I know

  • Batch rename of PSD, Save as JPEG, file gets old name

    I am using PS CS3 Suite. I have done a batch rename in Bridge CS3 of a folder of PSD files. When I subsequently save one as a JPEG it gets the old file name. Why?